diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2014-10-20 10:55:39 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2014-10-20 10:55:39 +0200 |
commit | 9f6b1b1e85ed029673eef041e7f1be9e2356a780 (patch) | |
tree | cec58b9ac8ac99fb7aa0676930ef009fdc23f090 /core/src/ch/asynk/tankontank/game | |
parent | ad8eedcc8904c34ce35e13798bbb64d3096a46f8 (diff) | |
download | RustAndDust-9f6b1b1e85ed029673eef041e7f1be9e2356a780.zip RustAndDust-9f6b1b1e85ed029673eef041e7f1be9e2356a780.tar.gz |
Paw,Unit: add boolean isA(PawnType type)
Diffstat (limited to 'core/src/ch/asynk/tankontank/game')
-rw-r--r-- | core/src/ch/asynk/tankontank/game/Unit.java | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/core/src/ch/asynk/tankontank/game/Unit.java b/core/src/ch/asynk/tankontank/game/Unit.java index acb0201..56736d2 100644 --- a/core/src/ch/asynk/tankontank/game/Unit.java +++ b/core/src/ch/asynk/tankontank/game/Unit.java @@ -12,7 +12,7 @@ public class Unit extends HeadedPawn { public static final int DISABLED = 0; - public enum UnitType + public enum UnitType implements Pawn.PawnType { HARD_TARGET, HARD_TARGET_HQ, @@ -121,15 +121,21 @@ public class Unit extends HeadedPawn } @Override - public boolean isHq() + public boolean isUnit() { - return (type == UnitType.HARD_TARGET_HQ); + return true; } @Override - public boolean isHardTarget() + public boolean isA(PawnType t) { - return ((type == UnitType.HARD_TARGET) || (type == UnitType.HARD_TARGET_HQ)); + return (type == t); + } + + @Override + public boolean isHq() + { + return (type == UnitType.HARD_TARGET_HQ); } @Override @@ -142,9 +148,9 @@ public class Unit extends HeadedPawn } @Override - public boolean isUnit() + public boolean isHardTarget() { - return true; + return ((type == UnitType.HARD_TARGET) || (type == UnitType.HARD_TARGET_HQ)); } @Override |