summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/ch/asynk')
-rw-r--r--core/src/ch/asynk/tankontank/engine/Board.java20
-rw-r--r--core/src/ch/asynk/tankontank/game/Ctrl.java10
-rw-r--r--core/src/ch/asynk/tankontank/game/Map.java14
-rw-r--r--core/src/ch/asynk/tankontank/game/states/StateBreak.java1
-rw-r--r--core/src/ch/asynk/tankontank/game/states/StateEngage.java1
-rw-r--r--core/src/ch/asynk/tankontank/game/states/StateMove.java1
-rw-r--r--core/src/ch/asynk/tankontank/game/states/StatePromote.java1
-rw-r--r--core/src/ch/asynk/tankontank/game/states/StateRotate.java1
-rw-r--r--core/src/ch/asynk/tankontank/game/states/StateWithdraw.java1
9 files changed, 27 insertions, 23 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/Board.java b/core/src/ch/asynk/tankontank/engine/Board.java
index b307ee7..e7e3105 100644
--- a/core/src/ch/asynk/tankontank/engine/Board.java
+++ b/core/src/ch/asynk/tankontank/engine/Board.java
@@ -218,9 +218,20 @@ public abstract class Board implements Disposable, Animation
protected void addAnimation(Animation a)
{
+ animationCount += 1;
nextAnimations.add(a);
}
+ protected void animationDone()
+ {
+ animationCount -= 1;
+ }
+
+ public int animationCount()
+ {
+ return animationCount;
+ }
+
private void stats()
{
boolean print = false;
@@ -230,10 +241,11 @@ public abstract class Board implements Disposable, Animation
print = true;
}
- if (animationCount != animations.size()) {
- animationCount = animations.size();
- print = true;
- }
+ // FIXME this will never be false
+ // if (animationCount != animations.size()) {
+ // animationCount = animations.size();
+ // print = true;
+ // }
if (print)
Gdx.app.debug("Board", " tiles:" + tileCount + " pawns:" + pawnCount + " animations:" + animationCount);
diff --git a/core/src/ch/asynk/tankontank/game/Ctrl.java b/core/src/ch/asynk/tankontank/game/Ctrl.java
index fb9495e..d4bd002 100644
--- a/core/src/ch/asynk/tankontank/game/Ctrl.java
+++ b/core/src/ch/asynk/tankontank/game/Ctrl.java
@@ -105,16 +105,8 @@ public class Ctrl implements Disposable
return (state != selectState);
}
- public void setAnimationCount(int count)
+ public void animationsOver()
{
- animationCount = count;
- }
-
- public void animationDone()
- {
- animationCount -= 1;
- if (animationCount > 0)
- return;
if (hud.dialogActive())
return;
leaveAnimationState();
diff --git a/core/src/ch/asynk/tankontank/game/Map.java b/core/src/ch/asynk/tankontank/game/Map.java
index b86b366..2faa217 100644
--- a/core/src/ch/asynk/tankontank/game/Map.java
+++ b/core/src/ch/asynk/tankontank/game/Map.java
@@ -463,12 +463,15 @@ public abstract class Map extends Board implements MoveToAnimationCb, ObjectiveS
});
}
- private void animationDone()
+ @Override
+ protected void animationDone()
{
+ soundId = -1;
+ super.animationDone();
+ if (animationCount() == 0)
+ ctrl.animationsOver();
if (soundId >= 0)
addAnimation( SoundAnimation.get(SoundAnimation.Action.FADE_OUT, sound, soundId, ctrl.cfg.fxVolume, 0.5f));
- soundId = -1;
- ctrl.animationDone();
}
private void addEngagementAnimation(Unit target)
@@ -577,7 +580,10 @@ public abstract class Map extends Board implements MoveToAnimationCb, ObjectiveS
unclaim(e.defender.getHex());
removePawn(e.defender);
destroy.set(2f, e.defender);
- addAnimation(destroy);
+ AnimationSequence seq = AnimationSequence.get(2);
+ seq.addAnimation(destroy);
+ seq.addAnimation(notifyDoneAnimation(e.defender));
+ addAnimation(seq);
}
if ((activatedUnits.size() == 1) && e.attacker.isA(Unit.UnitType.AT_GUN) && e.defender.isHardTarget())
diff --git a/core/src/ch/asynk/tankontank/game/states/StateBreak.java b/core/src/ch/asynk/tankontank/game/states/StateBreak.java
index 31b6315..9b87c23 100644
--- a/core/src/ch/asynk/tankontank/game/states/StateBreak.java
+++ b/core/src/ch/asynk/tankontank/game/states/StateBreak.java
@@ -83,7 +83,6 @@ public class StateBreak extends StateCommon
if (map.pathBuilder.build(to) == 1) {
map.pathBuilder.orientation = o;
map.moveUnit(activeUnit);
- ctrl.setAnimationCount(1);
ctrl.setAfterAnimationState(StateType.DONE);
} else
TankOnTank.debug("That's very wrong there should be only one path");
diff --git a/core/src/ch/asynk/tankontank/game/states/StateEngage.java b/core/src/ch/asynk/tankontank/game/states/StateEngage.java
index 048dbef..865907e 100644
--- a/core/src/ch/asynk/tankontank/game/states/StateEngage.java
+++ b/core/src/ch/asynk/tankontank/game/states/StateEngage.java
@@ -64,7 +64,6 @@ public class StateEngage extends StateCommon
}
activeUnit.showTarget();
- ctrl.setAnimationCount(map.activatedUnits.size());
ctrl.setAfterAnimationState(nextState);
return StateType.ANIMATION;
}
diff --git a/core/src/ch/asynk/tankontank/game/states/StateMove.java b/core/src/ch/asynk/tankontank/game/states/StateMove.java
index cce19a6..9a8195d 100644
--- a/core/src/ch/asynk/tankontank/game/states/StateMove.java
+++ b/core/src/ch/asynk/tankontank/game/states/StateMove.java
@@ -76,7 +76,6 @@ public class StateMove extends StateCommon
int n = map.activatedUnits.size();
if (n == 0)
return StateType.ABORT;
- ctrl.setAnimationCount(n);
map.revertMoves();
return StateType.ANIMATION;
}
diff --git a/core/src/ch/asynk/tankontank/game/states/StatePromote.java b/core/src/ch/asynk/tankontank/game/states/StatePromote.java
index 81d6d7e..9f327e7 100644
--- a/core/src/ch/asynk/tankontank/game/states/StatePromote.java
+++ b/core/src/ch/asynk/tankontank/game/states/StatePromote.java
@@ -7,7 +7,6 @@ public class StatePromote extends StateCommon
@Override
public void enter(StateType prevState)
{
- ctrl.setAnimationCount(1);
ctrl.setAfterAnimationState(StateType.DONE);
ctrl.setState(StateType.ANIMATION);
map.promoteUnit(selectedUnit);
diff --git a/core/src/ch/asynk/tankontank/game/states/StateRotate.java b/core/src/ch/asynk/tankontank/game/states/StateRotate.java
index 6b60dfb..d297840 100644
--- a/core/src/ch/asynk/tankontank/game/states/StateRotate.java
+++ b/core/src/ch/asynk/tankontank/game/states/StateRotate.java
@@ -73,7 +73,6 @@ public class StateRotate extends StateCommon
if (map.moveUnit(activeUnit) > 0)
whenDone = StateType.MOVE;
- ctrl.setAnimationCount(1);
ctrl.setAfterAnimationState(whenDone);
return StateType.ANIMATION;
}
diff --git a/core/src/ch/asynk/tankontank/game/states/StateWithdraw.java b/core/src/ch/asynk/tankontank/game/states/StateWithdraw.java
index 43c38cc..87c33b8 100644
--- a/core/src/ch/asynk/tankontank/game/states/StateWithdraw.java
+++ b/core/src/ch/asynk/tankontank/game/states/StateWithdraw.java
@@ -29,7 +29,6 @@ public class StateWithdraw extends StateCommon
if (activeUnit == null)
activeUnit = selectedUnit;
- ctrl.setAnimationCount(1);
ctrl.setAfterAnimationState(withdraw(activeUnit));
return StateType.ANIMATION;
}