summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2016-03-31 20:13:15 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2016-03-31 20:13:15 +0200
commitbe736b3a1c31eed88711dc1ae750e9bfdd1f3e63 (patch)
treee126fd0eb9520145d02a488be5a1e4ec3be43f64
parent6a9742d7c8b89c8eebb91cad62395db0fc1dc0b3 (diff)
downloadRustAndDust-be736b3a1c31eed88711dc1ae750e9bfdd1f3e63.zip
RustAndDust-be736b3a1c31eed88711dc1ae750e9bfdd1f3e63.tar.gz
Ctrl: add EventType.TOGGLE_REINFORCEMENT
-rw-r--r--core/src/ch/asynk/rustanddust/game/Ctrl.java8
-rw-r--r--core/src/ch/asynk/rustanddust/game/hud/PlayerInfo.java2
2 files changed, 7 insertions, 3 deletions
diff --git a/core/src/ch/asynk/rustanddust/game/Ctrl.java b/core/src/ch/asynk/rustanddust/game/Ctrl.java
index 53945c7..bbdc8df 100644
--- a/core/src/ch/asynk/rustanddust/game/Ctrl.java
+++ b/core/src/ch/asynk/rustanddust/game/Ctrl.java
@@ -34,7 +34,8 @@ public abstract class Ctrl implements Disposable
{
STATE_CHANGE,
HUD_ANSWER,
- ANIMATIONS_DONE;
+ ANIMATIONS_DONE,
+ TOGGLE_REINFORCEMENT;
}
class Event
@@ -216,6 +217,9 @@ public abstract class Ctrl implements Disposable
case ANIMATIONS_DONE:
animationsDone();
break;
+ case TOGGLE_REINFORCEMENT:
+ toggleReinforcement();
+ break;
default:
RustAndDust.error(String.format("Unhandled Event Type : %s %s", evt.type, evt.data));
}
@@ -323,7 +327,7 @@ public abstract class Ctrl implements Disposable
state.touch(null);
}
- public void reinforcementHit()
+ private void toggleReinforcement()
{
if (this.stateType == StateType.SELECT)
setState(StateType.REINFORCEMENT);
diff --git a/core/src/ch/asynk/rustanddust/game/hud/PlayerInfo.java b/core/src/ch/asynk/rustanddust/game/hud/PlayerInfo.java
index ef05187..2719a87 100644
--- a/core/src/ch/asynk/rustanddust/game/hud/PlayerInfo.java
+++ b/core/src/ch/asynk/rustanddust/game/hud/PlayerInfo.java
@@ -141,7 +141,7 @@ public class PlayerInfo implements Disposable, Drawable, Animation
return true;
}
else if (reinforcement.hit(x, y)) {
- ctrl.reinforcementHit();
+ ctrl.postEvent(Ctrl.EventType.TOGGLE_REINFORCEMENT);
return true;
}
else if (unitDock.hit(x, y)) {