diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2014-10-06 16:28:19 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2014-10-06 16:28:19 +0200 |
commit | 940cf359bdc79875dfd58725eca41f8bf4b6f47a (patch) | |
tree | b0f90d3f26f297981a2f15a825cd9d78f9be38a0 /core/src/ch/asynk/tankontank/game/states | |
parent | 413470de7d87de33752930a67a7e8d65c5f9032f (diff) | |
download | RustAndDust-940cf359bdc79875dfd58725eca41f8bf4b6f47a.zip RustAndDust-940cf359bdc79875dfd58725eca41f8bf4b6f47a.tar.gz |
add abort() and enter() to GameState, set default implementation in GameStateCommon
Diffstat (limited to 'core/src/ch/asynk/tankontank/game/states')
-rw-r--r-- | core/src/ch/asynk/tankontank/game/states/GameStateCommon.java | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/core/src/ch/asynk/tankontank/game/states/GameStateCommon.java b/core/src/ch/asynk/tankontank/game/states/GameStateCommon.java index d02d345..8b921f7 100644 --- a/core/src/ch/asynk/tankontank/game/states/GameStateCommon.java +++ b/core/src/ch/asynk/tankontank/game/states/GameStateCommon.java @@ -30,6 +30,28 @@ public abstract class GameStateCommon implements GameState this.map = map; } + @Override + public void enter() + { + map.hidePossibles(); + unselectHex(); + pawn = null; + } + + @Override + public void abort() + { + ctrl.setState(State.VIEW); + } + + @Override + public void touchDown() + { + unselectHex(); + setHex(); + selectHex(); + } + protected static boolean hexInMap(GridPoint2 hex) { if (hex.x == -1) return false; @@ -72,4 +94,9 @@ public abstract class GameStateCommon implements GameState { map.enableOverlayOn(hex, Hex.BLUE, true); } + + protected boolean downIsHex() + { + return ((downHex.x == hex.x) && (upHex.y == hex.y)); + } } |