summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-10-10 13:50:46 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2014-10-10 13:50:46 +0200
commitcca31b267eea699f49be051f88ec10d5d904b312 (patch)
treef8d7eae12c169eb43dfe0642ff5d87ded9bfdbec
parent198545a324dd215f2ef4e4011d20970cfefaa4b1 (diff)
downloadRustAndDust-cca31b267eea699f49be051f88ec10d5d904b312.zip
RustAndDust-cca31b267eea699f49be051f88ec10d5d904b312.tar.gz
Unit: implement attack(Pawn), revertLastMove() rotate(Orientation)
-rw-r--r--core/src/ch/asynk/tankontank/game/Unit.java23
1 files changed, 17 insertions, 6 deletions
diff --git a/core/src/ch/asynk/tankontank/game/Unit.java b/core/src/ch/asynk/tankontank/game/Unit.java
index b5924f3..d33e688 100644
--- a/core/src/ch/asynk/tankontank/game/Unit.java
+++ b/core/src/ch/asynk/tankontank/game/Unit.java
@@ -6,6 +6,7 @@ import com.badlogic.gdx.graphics.g2d.TextureAtlas;
import ch.asynk.tankontank.engine.Pawn;
import ch.asynk.tankontank.engine.Tile;
import ch.asynk.tankontank.engine.HeadedPawn;
+import ch.asynk.tankontank.engine.Orientation;
public class Unit extends HeadedPawn
{
@@ -98,28 +99,38 @@ public class Unit extends HeadedPawn
return isEnemy(other);
}
- public void fire()
- {
- hasFired = true;
- }
-
- public void rotate()
+ @Override
+ public void rotate(Orientation o)
{
hasMoved = true;
}
+ @Override
public void move(int cost)
{
hasMoved = true;
if (cost > mp) System.err.println("Movement point exceeded: " + cost + "/" + mp);
}
+ @Override
+ public void attack(Pawn target)
+ {
+ hasFired = true;
+ }
+
+ @Override
public void reset()
{
hasFired = false;
hasMoved = false;
}
+ @Override
+ public void revertLastMove()
+ {
+ hasMoved = false;
+ }
+
// hard tager
public Unit(Army army, boolean hq, int range, int defense, int movementPoints, TextureAtlas atlas, String unit, String head)
{