summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk/tankontank/game
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-11-30 02:20:16 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2014-11-30 02:20:16 +0100
commitc64bd7e354033bda6414c3a51ed9cde414c6541f (patch)
tree3daa3514da1a7013d5546ad88afd0bae9e141c24 /core/src/ch/asynk/tankontank/game
parent1fc52fb536c121d6ebf608a9b46784771f47b5e7 (diff)
downloadRustAndDust-c64bd7e354033bda6414c3a51ed9cde414c6541f.zip
RustAndDust-c64bd7e354033bda6414c3a51ed9cde414c6541f.tar.gz
Ctrl,Hud: wait for animations and dialogs to be closed before leaving animation state
Diffstat (limited to 'core/src/ch/asynk/tankontank/game')
-rw-r--r--core/src/ch/asynk/tankontank/game/Ctrl.java21
-rw-r--r--core/src/ch/asynk/tankontank/game/Hud.java4
2 files changed, 14 insertions, 11 deletions
diff --git a/core/src/ch/asynk/tankontank/game/Ctrl.java b/core/src/ch/asynk/tankontank/game/Ctrl.java
index 341292b..11b20a8 100644
--- a/core/src/ch/asynk/tankontank/game/Ctrl.java
+++ b/core/src/ch/asynk/tankontank/game/Ctrl.java
@@ -107,16 +107,17 @@ public class Ctrl implements Disposable
public void animationDone()
{
animationCount -= 1;
- if (animationCount == 0) {
- animationCount = map.animationsDone();
- if (animationCount == 0) {
- StateType tmp = stateAfterAnimation;
- stateAfterAnimation = StateType.DONE;
- setState(tmp);
- }
- }
- if (animationCount < 0)
- TankOnTank.debug(" animationCount < 0");
+ if (animationCount > 0)
+ return;
+ animationCount = map.animationsDone();
+ if (animationCount > 0)
+ return;
+ if (hud.dialogActive())
+ return;
+
+ StateType tmp = stateAfterAnimation;
+ stateAfterAnimation = StateType.DONE;
+ setState(tmp);
}
private void startPlayerTurn()
diff --git a/core/src/ch/asynk/tankontank/game/Hud.java b/core/src/ch/asynk/tankontank/game/Hud.java
index 7de65db..f1e6424 100644
--- a/core/src/ch/asynk/tankontank/game/Hud.java
+++ b/core/src/ch/asynk/tankontank/game/Hud.java
@@ -180,7 +180,9 @@ public class Hud implements Disposable
closeOkCancel();
else if (dialog == stats)
ctrl.endGame();
- // else if (dialog == engagement)
+ else if (dialog == engagement) {
+ ctrl.animationDone();
+ }
if (dialogs.size() > 0)
dialogs.getFirst().visible = true;