diff options
Diffstat (limited to 'core/src/ch')
-rw-r--r-- | core/src/ch/asynk/tankontank/engine/Tile.java | 5 | ||||
-rw-r--r-- | core/src/ch/asynk/tankontank/game/Hex.java | 8 |
2 files changed, 12 insertions, 1 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/Tile.java b/core/src/ch/asynk/tankontank/engine/Tile.java index 4065346..ed861db 100644 --- a/core/src/ch/asynk/tankontank/engine/Tile.java +++ b/core/src/ch/asynk/tankontank/engine/Tile.java @@ -17,6 +17,10 @@ import ch.asynk.tankontank.engine.gfx.StackedImages; public abstract class Tile implements Drawable, Disposable, Iterable<Pawn> { + public interface TileTerrain + { + } + protected int col; protected int row; protected float x; @@ -28,6 +32,7 @@ public abstract class Tile implements Drawable, Disposable, Iterable<Pawn> public abstract int costFrom(Pawn pawn, Orientation side); public abstract boolean isOffMap(); + public abstract boolean isA(TileTerrain terrain); public abstract boolean road(Orientation side); public abstract boolean atLeastOneMove(Pawn pawn); public abstract boolean blockLineOfSightFrom(Tile tile); diff --git a/core/src/ch/asynk/tankontank/game/Hex.java b/core/src/ch/asynk/tankontank/game/Hex.java index 656a1e6..7abf0d3 100644 --- a/core/src/ch/asynk/tankontank/game/Hex.java +++ b/core/src/ch/asynk/tankontank/game/Hex.java @@ -12,7 +12,7 @@ import ch.asynk.tankontank.engine.Orientation; public class Hex extends Tile { - public enum Terrain + public enum Terrain implements TileTerrain { OFFMAP, BLOCKED, @@ -52,6 +52,12 @@ public class Hex extends Tile } @Override + public boolean isA(TileTerrain terrain) + { + return (this.terrain == terrain); + } + + @Override public boolean isOffMap() { return terrain == Terrain.OFFMAP; |