From cca31b267eea699f49be051f88ec10d5d904b312 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Fri, 10 Oct 2014 13:50:46 +0200 Subject: Unit: implement attack(Pawn), revertLastMove() rotate(Orientation) --- core/src/ch/asynk/tankontank/game/Unit.java | 23 +++++++++++++++++------ 1 file 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) { -- cgit v1.1-2-g2b99