diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2014-11-17 16:18:15 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2014-11-17 16:18:15 +0100 |
commit | a31850c31c0f2f70e9bd191f6d69f43abd619696 (patch) | |
tree | 2b77cdf63059751d9efb181121c6bbf03eb45eb7 /core | |
parent | bae96611e3659847f3bbf6583ae63ebcb960a2c6 (diff) | |
download | RustAndDust-a31850c31c0f2f70e9bd191f6d69f43abd619696.zip RustAndDust-a31850c31c0f2f70e9bd191f6d69f43abd619696.tar.gz |
Tile: add interface TileTerrain, boolean isA(TileTerrain terrain)
Diffstat (limited to 'core')
-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; |