From 149bb7ac1903a81689ab1ce214c1b30aebf07f81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Sat, 15 Nov 2014 17:15:51 +0100 Subject: StateRotation: doRotation return after animation state --- .../ch/asynk/tankontank/game/states/StateRotate.java | 18 ++++++++---------- 1 file 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; } } -- cgit v1.1-2-g2b99