summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2015-02-18 14:49:40 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2015-02-18 14:49:40 +0100
commit07cb6f5d7c5f48b05391824bbfc364a03cdcad5f (patch)
tree7fc041d8f5622908e9c1ad7a837b7bf60a4f5075
parent2d5302585838851e1dcb5164dee46c65295224e4 (diff)
downloadRustAndDust-07cb6f5d7c5f48b05391824bbfc364a03cdcad5f.zip
RustAndDust-07cb6f5d7c5f48b05391824bbfc364a03cdcad5f.tar.gz
Map: reorder STATE ENTRY methods
-rw-r--r--core/src/ch/asynk/tankontank/game/Map.java50
1 files changed, 28 insertions, 22 deletions
diff --git a/core/src/ch/asynk/tankontank/game/Map.java b/core/src/ch/asynk/tankontank/game/Map.java
index 3a004ed..3b1a5b4 100644
--- a/core/src/ch/asynk/tankontank/game/Map.java
+++ b/core/src/ch/asynk/tankontank/game/Map.java
@@ -344,23 +344,6 @@ public abstract class Map extends Board implements MoveToAnimationCb, ObjectiveS
return process(unit, pathBuilder.getExitMove());
}
- public void promoteUnit(final Player player, final Unit unit)
- {
- activatedUnits.add(unit);
-
- Hex hex = unit.getHex();
- AnimationSequence seq = AnimationSequence.get(2);
- seq.addAnimation(PromoteAnimation.get((unit.getArmy() == Army.US), ctrl.mapTouch.x, ctrl.mapTouch.y, hex.getX(), hex.getY(), ctrl.cfg.fxVolume));
- seq.addAnimation ( RunnableAnimation.get(unit, new Runnable() {
- @Override
- public void run() {
- player.promote(unit);
- animationDone();
- }
- }));
- addAnimation(seq);
- }
-
public int moveUnit(Unit unit)
{
return process(unit, pathBuilder.getMove());
@@ -385,6 +368,32 @@ public abstract class Map extends Board implements MoveToAnimationCb, ObjectiveS
ctrl.player.revertUnitEntry(unit);
}
+ public boolean engageUnit(Unit unit, final Unit target)
+ {
+ // FIXME engageUnit -> process
+ attack(unit, target, true);
+ engagement = Engagement.get(unit, target);
+ return engage(unit, target, engagement);
+ }
+
+ public void promoteUnit(final Player player, final Unit unit)
+ {
+ // FIXME promoteUnit -> process
+ activatedUnits.add(unit);
+
+ Hex hex = unit.getHex();
+ AnimationSequence seq = AnimationSequence.get(2);
+ seq.addAnimation(PromoteAnimation.get((unit.getArmy() == Army.US), ctrl.mapTouch.x, ctrl.mapTouch.y, hex.getX(), hex.getY(), ctrl.cfg.fxVolume));
+ seq.addAnimation ( RunnableAnimation.get(unit, new Runnable() {
+ @Override
+ public void run() {
+ player.promote(unit);
+ animationDone();
+ }
+ }));
+ addAnimation(seq);
+ }
+
// STATES ENTRY <-
private void initMove(Unit unit)
@@ -513,12 +522,9 @@ public abstract class Map extends Board implements MoveToAnimationCb, ObjectiveS
return success;
}
- public boolean engageUnit(Unit unit, final Unit target)
+ private boolean engage(Unit unit, final Unit target, Engagement e)
{
- attack(unit, target, true);
- engagement = Engagement.get(unit, target);
-
- boolean success = resolveFight(unit, target, engagement);
+ boolean success = resolveFight(unit, target, e);
breakUnits.clear();
for (Unit u : activatedUnits) {