diff options
-rw-r--r-- | core/src/ch/asynk/tankontank/game/Ctrl.java | 14 | ||||
-rw-r--r-- | core/src/ch/asynk/tankontank/game/hud/PlayerInfo.java | 2 |
2 files changed, 7 insertions, 9 deletions
diff --git a/core/src/ch/asynk/tankontank/game/Ctrl.java b/core/src/ch/asynk/tankontank/game/Ctrl.java index 203bed9..acc92dd 100644 --- a/core/src/ch/asynk/tankontank/game/Ctrl.java +++ b/core/src/ch/asynk/tankontank/game/Ctrl.java @@ -172,15 +172,13 @@ public class Ctrl implements Disposable this.state.touchUp(); } - public void toggleState(StateType stateA, StateType stateB) + + public void reinforcementHit() { - if (this.stateType == stateA) { - setState(stateB); - } else if (this.stateType == stateB) { - setState(stateA); - } else { - TankOnTank.debug("Ctrl", "wrong call to toggleState()"); - } + if (this.stateType == StateType.SELECT) + setState(StateType.REINFORCEMENT); + else if (this.stateType == StateType.REINFORCEMENT) + setState(StateType.SELECT); } public void setState(StateType nextState) diff --git a/core/src/ch/asynk/tankontank/game/hud/PlayerInfo.java b/core/src/ch/asynk/tankontank/game/hud/PlayerInfo.java index 5b7b54e..ffc76c6 100644 --- a/core/src/ch/asynk/tankontank/game/hud/PlayerInfo.java +++ b/core/src/ch/asynk/tankontank/game/hud/PlayerInfo.java @@ -141,7 +141,7 @@ public class PlayerInfo implements Disposable, Drawable } else if (hit == reinforcement) { if (reinforcement.hit(x, y)) - ctrl.toggleState(StateType.REINFORCEMENT, StateType.SELECT); + ctrl.reinforcementHit(); } else if (hit == unitDock) { if (unitDock.hit(x, y)) |