summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-11-04 15:54:33 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2014-11-04 15:54:33 +0100
commit4703a17cac8f2f0f74542c4fc0b371d24d052b4d (patch)
tree7d40392a436d1c04c6cf58cab501fad9fac62ab1 /core
parent3b815a900a2ada8aeeb288e3905bf5dc429e19b8 (diff)
downloadRustAndDust-4703a17cac8f2f0f74542c4fc0b371d24d052b4d.zip
RustAndDust-4703a17cac8f2f0f74542c4fc0b371d24d052b4d.tar.gz
Ctrl: keep track of current StateType, notify Hud on change
Diffstat (limited to 'core')
-rw-r--r--core/src/ch/asynk/tankontank/game/Ctrl.java6
-rw-r--r--core/src/ch/asynk/tankontank/game/Hud.java4
2 files changed, 9 insertions, 1 deletions
diff --git a/core/src/ch/asynk/tankontank/game/Ctrl.java b/core/src/ch/asynk/tankontank/game/Ctrl.java
index 07f6a2c..c9941f2 100644
--- a/core/src/ch/asynk/tankontank/game/Ctrl.java
+++ b/core/src/ch/asynk/tankontank/game/Ctrl.java
@@ -34,6 +34,7 @@ public class Ctrl implements Disposable
private int animationCount = 0;
private State state;
+ private State.StateType stateType;
public Ctrl(final TankOnTank game, final Battle battle)
{
@@ -56,11 +57,12 @@ public class Ctrl implements Disposable
this.animationState = new StateAnimation();
this.state = selectState;
+ this.stateType = State.StateType.SELECT;
this.hud = new Hud(this, game);
player.turnStart();
- this.hud.update();
+ hud.update();
}
@Override
@@ -132,6 +134,7 @@ public class Ctrl implements Disposable
public void setState(State.StateType state, boolean normal)
{
+ hud.changeState(stateType, state);
this.state.leave(state);
System.err.println(" switch to : " + state + " " + normal);
@@ -161,6 +164,7 @@ public class Ctrl implements Disposable
default:
break;
}
+ stateType = state;
this.state.enter(normal);
}
diff --git a/core/src/ch/asynk/tankontank/game/Hud.java b/core/src/ch/asynk/tankontank/game/Hud.java
index 5282efb..32c8d03 100644
--- a/core/src/ch/asynk/tankontank/game/Hud.java
+++ b/core/src/ch/asynk/tankontank/game/Hud.java
@@ -124,6 +124,10 @@ public class Hud implements Disposable
reinforcement.dispose();
}
+ public void changeState(StateType from, StateType to)
+ {
+ }
+
public void animate(float delta)
{
msg.animate(delta);