From 119ab78da2b9021c84239946a2d9146d3df8dbcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Wed, 5 Nov 2014 16:30:49 +0100 Subject: add Pawn.Move --- core/src/ch/asynk/tankontank/engine/Pawn.java | 41 +++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/core/src/ch/asynk/tankontank/engine/Pawn.java b/core/src/ch/asynk/tankontank/engine/Pawn.java index 00978b2..3d0b341 100644 --- a/core/src/ch/asynk/tankontank/engine/Pawn.java +++ b/core/src/ch/asynk/tankontank/engine/Pawn.java @@ -47,6 +47,45 @@ public abstract class Pawn implements Moveable, Disposable } } + public class Move + { + Tile from; + Tile to; + int distance; + public int cost; + boolean roadMarch; + public boolean entryMove; + Orientation orientation; + + public String toString() + { + if (from == null) + return "move : reinforcement -> [" + to.col + ";" + to.row + ";" + orientation + "] dist:" + distance + " cost:" + cost + " road:" + roadMarch + " entry:" + entryMove; + else + return "move : [" + from.col + ";" + from.row + "] -> [" + to.col + ";" + to.row + ";" + orientation + "] dist:" + distance + " cost:" + cost + " road:" + roadMarch + " entry:" + entryMove; + } + + public void setRotation(Tile tile, Orientation o) + { + from = tile; + to = tile; + cost = 0; + roadMarch = false; + entryMove = false; + orientation = o; + } + + public void reset() + { + from = null; + to = null; + cost = Integer.MAX_VALUE; + roadMarch = false; + entryMove = false; + orientation = Orientation.KEEP; + } + } + private static final float MOVE_TIME = 0.4f; private Vector3 position; @@ -58,6 +97,7 @@ public abstract class Pawn implements Moveable, Disposable private Image image; private StackedImages overlays; public Attack attack = new Attack(); + public Move move = new Move(); public abstract int getMovementPoints(); public abstract int getRoadMarchBonus(); @@ -116,6 +156,7 @@ public abstract class Pawn implements Moveable, Disposable public void reset() { attack.reset(); + move.reset(); } public boolean isEnemy(Faction other) -- cgit v1.1-2-g2b99