diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2014-11-15 17:15:51 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2014-11-15 17:15:51 +0100 |
commit | 149bb7ac1903a81689ab1ce214c1b30aebf07f81 (patch) | |
tree | b4a4a91339859c7a0615f8aad592ae768458faf9 /core | |
parent | 7c632e6e19c32fb8eff0464b5d5ea1a775c26358 (diff) | |
download | RustAndDust-149bb7ac1903a81689ab1ce214c1b30aebf07f81.zip RustAndDust-149bb7ac1903a81689ab1ce214c1b30aebf07f81.tar.gz |
StateRotation: doRotation return after animation state
Diffstat (limited to 'core')
-rw-r--r-- | core/src/ch/asynk/tankontank/game/states/StateRotate.java | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/core/src/ch/asynk/tankontank/game/states/StateRotate.java b/core/src/ch/asynk/tankontank/game/states/StateRotate.java index a9a045b..9164154 100644 --- a/core/src/ch/asynk/tankontank/game/states/StateRotate.java +++ b/core/src/ch/asynk/tankontank/game/states/StateRotate.java @@ -71,10 +71,8 @@ public class StateRotate extends StateCommon @Override public StateType done() { - doRotation(o); - if (selectedUnit.canMove() && (map.activatedPawns.size() > 0)) - selectedUnit.move(); - return StateType.DONE; + ctrl.setAfterAnimationState(doRotation(o)); + return StateType.ANIMATION; } @Override @@ -98,8 +96,10 @@ public class StateRotate extends StateCommon map.hideDirections(to); map.showOrientation(to, o); ctrl.hud.actionButtons.show(Buttons.ROTATE.b | Buttons.DONE.b | ((ctrl.cfg.canCancel) ? Buttons.ABORT.b : 0)); - } else - doRotation(o); + } else { + ctrl.setAfterAnimationState(doRotation(o)); + ctrl.setState(StateType.ANIMATION); + } } private void hideAssists() @@ -107,10 +107,8 @@ public class StateRotate extends StateCommon map.hideMoveablePawns(); } - private void doRotation(Orientation o) + private StateType doRotation(Orientation o) { - if (!rotationSet) return; - StateType whenDone = StateType.DONE; ctrl.hud.notify("Move " + activeUnit); @@ -118,6 +116,6 @@ public class StateRotate extends StateCommon if (map.movePawn(activeUnit, o) > 0) whenDone = StateType.MOVE; - ctrl.setState(StateType.ANIMATION, whenDone); + return whenDone; } } |