summaryrefslogtreecommitdiffstats
path: root/core/src
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-11-26 23:45:00 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2014-11-26 23:45:00 +0100
commit7db960a86c1c1d9ead95188ba86b467bfd56eee4 (patch)
treeb607236d138af703c7433fb5b171731da5c1cd6f /core/src
parent777a0edf963f5ccc6854162fd178f282ff9edb47 (diff)
downloadRustAndDust-7db960a86c1c1d9ead95188ba86b467bfd56eee4.zip
RustAndDust-7db960a86c1c1d9ead95188ba86b467bfd56eee4.tar.gz
Ctrl,Map: Map.animationsDone() returns the count of new animations to run, thus Ctrl might stay in ANIMATION
Diffstat (limited to 'core/src')
-rw-r--r--core/src/ch/asynk/tankontank/game/Ctrl.java10
-rw-r--r--core/src/ch/asynk/tankontank/game/Map.java10
2 files changed, 13 insertions, 7 deletions
diff --git a/core/src/ch/asynk/tankontank/game/Ctrl.java b/core/src/ch/asynk/tankontank/game/Ctrl.java
index a54deaf..cf08d3f 100644
--- a/core/src/ch/asynk/tankontank/game/Ctrl.java
+++ b/core/src/ch/asynk/tankontank/game/Ctrl.java
@@ -113,10 +113,12 @@ public class Ctrl implements Disposable
{
animationCount -= 1;
if (animationCount == 0) {
- map.animationsDone();
- StateType tmp = stateAfterAnimation;
- stateAfterAnimation = StateType.DONE;
- setState(tmp);
+ animationCount = map.animationsDone();
+ if (animationCount == 0) {
+ StateType tmp = stateAfterAnimation;
+ stateAfterAnimation = StateType.DONE;
+ setState(tmp);
+ }
}
if (animationCount < 0)
TankOnTank.debug(" animationCount < 0");
diff --git a/core/src/ch/asynk/tankontank/game/Map.java b/core/src/ch/asynk/tankontank/game/Map.java
index 1209652..7d3cba3 100644
--- a/core/src/ch/asynk/tankontank/game/Map.java
+++ b/core/src/ch/asynk/tankontank/game/Map.java
@@ -188,12 +188,15 @@ public abstract class Map extends Board
activatedUnits.clear();
}
- public void animationsDone()
+ public int animationsDone()
{
ShotAnimation.resetAll();
- if (animationClosure != null)
+ if (animationClosure != null) {
addAnimation(animationClosure);
- animationClosure = null;
+ animationClosure = null;
+ return 1;
+ }
+ return 0;
}
// ACTIONS
@@ -374,6 +377,7 @@ public abstract class Map extends Board
public void run() {
objectives.unclaim(target.getHex());
removePawn(target);
+ animationDone();
}
});
}