summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk/tankontank
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-11-05 16:30:49 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2014-11-05 16:30:49 +0100
commit119ab78da2b9021c84239946a2d9146d3df8dbcc (patch)
tree7949f21b0175b41c8a68f7ff12542a6a4338ab90 /core/src/ch/asynk/tankontank
parentbcd434d698bc03697b259356b09ee3c8628cd191 (diff)
downloadRustAndDust-119ab78da2b9021c84239946a2d9146d3df8dbcc.zip
RustAndDust-119ab78da2b9021c84239946a2d9146d3df8dbcc.tar.gz
add Pawn.Move
Diffstat (limited to 'core/src/ch/asynk/tankontank')
-rw-r--r--core/src/ch/asynk/tankontank/engine/Pawn.java41
1 files changed, 41 insertions, 0 deletions
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)