diff options
Diffstat (limited to 'core/src/ch')
-rw-r--r-- | core/src/ch/asynk/tankontank/engine/Pawn.java | 1 | ||||
-rw-r--r-- | core/src/ch/asynk/tankontank/game/Army.java | 7 | ||||
-rw-r--r-- | core/src/ch/asynk/tankontank/game/Unit.java | 6 |
3 files changed, 13 insertions, 1 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/Pawn.java b/core/src/ch/asynk/tankontank/engine/Pawn.java index 8da9774..f5304c7 100644 --- a/core/src/ch/asynk/tankontank/engine/Pawn.java +++ b/core/src/ch/asynk/tankontank/engine/Pawn.java @@ -26,6 +26,7 @@ public abstract class Pawn extends Image implements Disposable public abstract int getMvt(); public abstract int roadMarch(); + public abstract boolean isEnemy(Pawn other); public Pawn(TextureRegion region, TextureAtlas atlas) { diff --git a/core/src/ch/asynk/tankontank/game/Army.java b/core/src/ch/asynk/tankontank/game/Army.java index 95b06e9..66c6b4f 100644 --- a/core/src/ch/asynk/tankontank/game/Army.java +++ b/core/src/ch/asynk/tankontank/game/Army.java @@ -2,5 +2,10 @@ package ch.asynk.tankontank.game; public enum Army { - GE, US + GE, US; + + public boolean isEnemy(Army other) + { + return (this != other); + } } diff --git a/core/src/ch/asynk/tankontank/game/Unit.java b/core/src/ch/asynk/tankontank/game/Unit.java index 40fb68d..d9f0789 100644 --- a/core/src/ch/asynk/tankontank/game/Unit.java +++ b/core/src/ch/asynk/tankontank/game/Unit.java @@ -27,6 +27,12 @@ public class Unit extends Pawn return 1; } + @Override + public boolean isEnemy(Pawn other) + { + return army.isEnemy(((Unit) other).army); + } + // hard tager public Unit(Army army, boolean hq, int range, int defense, int movementPoints, TextureRegion region, TextureAtlas atlas) { |