diff options
Diffstat (limited to 'core/src/ch')
-rw-r--r-- | core/src/ch/asynk/tankontank/engine/Board.java | 1 | ||||
-rw-r--r-- | core/src/ch/asynk/tankontank/engine/PossiblePaths.java | 12 |
2 files changed, 13 insertions, 0 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/Board.java b/core/src/ch/asynk/tankontank/engine/Board.java index 78629f9..0a076c7 100644 --- a/core/src/ch/asynk/tankontank/engine/Board.java +++ b/core/src/ch/asynk/tankontank/engine/Board.java @@ -436,6 +436,7 @@ public abstract class Board implements Disposable protected void movePawn(final Pawn pawn, PossiblePaths possiblePaths, RunnableAnimation whenDone) { + possiblePaths.applyToPawn(0); removePawn(pawn); AnimationSequence seq = pawn.getMoveAnimation(possiblePaths.iterator(), possiblePaths.pathSteps(0) + 2); diff --git a/core/src/ch/asynk/tankontank/engine/PossiblePaths.java b/core/src/ch/asynk/tankontank/engine/PossiblePaths.java index cf97653..318aafc 100644 --- a/core/src/ch/asynk/tankontank/engine/PossiblePaths.java +++ b/core/src/ch/asynk/tankontank/engine/PossiblePaths.java @@ -168,6 +168,14 @@ public class PossiblePaths implements Iterable<Vector3> return filteredPaths.size(); } + public void applyToPawn(int i) + { + pawn.move.from = from; + pawn.move.to = to; + pawn.move.orientation = orientation; + pathCost(i); + } + public int pathCost(int i) { int cost = 0; @@ -188,6 +196,10 @@ public class PossiblePaths implements Iterable<Vector3> if (cost < 1) cost = 1; + pawn.move.cost = cost; + pawn.move.roadMarch = roadMarch; + pawn.move.distance = (1 + paths.get(i).size()); + return cost; } |