summaryrefslogtreecommitdiffstats
path: root/core/src/ch
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/ch')
-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) {