diff options
Diffstat (limited to 'core')
3 files changed, 31 insertions, 11 deletions
diff --git a/core/src/ch/asynk/tankontank/game/states/GameStateDirection.java b/core/src/ch/asynk/tankontank/game/states/GameStateDirection.java index 658c70a..ce9d124 100644 --- a/core/src/ch/asynk/tankontank/game/states/GameStateDirection.java +++ b/core/src/ch/asynk/tankontank/game/states/GameStateDirection.java @@ -39,7 +39,7 @@ public class GameStateDirection extends GameStateCommon private void clear() { map.enableFinalPath(tmp, false); - map.enableMoveAssist(false); + map.enableMoveAssists(false); if (to.x != -1) unselectHex(to); if (from.x != -1) unselectHex(to); to.set(-1, -1); diff --git a/core/src/ch/asynk/tankontank/game/states/GameStateMove.java b/core/src/ch/asynk/tankontank/game/states/GameStateMove.java index fc77f2f..91ce9e1 100644 --- a/core/src/ch/asynk/tankontank/game/states/GameStateMove.java +++ b/core/src/ch/asynk/tankontank/game/states/GameStateMove.java @@ -13,8 +13,7 @@ public class GameStateMove extends GameStateCommon selectHex(hex); skipFirst = false; map.clearPossiblePaths(); - map.buildAndShowPossibleMoves(pawn, hex); - map.buildAndShowMoveAssist(pawn, hex); + buildAndShowMoves(); } } @@ -26,8 +25,7 @@ public class GameStateMove extends GameStateCommon if (hasPawn()) { skipFirst = true; map.clearPossiblePaths(); - map.buildAndShowPossibleMoves(pawn, hex); - map.buildAndShowMoveAssist(pawn, hex); + buildAndShowMoves(); } } } @@ -65,13 +63,29 @@ public class GameStateMove extends GameStateCommon @Override public void abort() { - map.enableMoveAssist(false); + clear(); + super.abort(); + } + + private void buildAndShowMoves() + { map.enablePossibleMoves(false); + map.enableMoveAssists(false); + map.buildPossibleMoves(pawn, hex); + map.buildMoveAssists(pawn, hex); + map.enablePossibleMoves(true); + map.enableMoveAssists(true); + } + + private void clear() + { + map.enableMoveAssists(false); + map.enablePossibleMoves(false); + map.enableFinalPath(tmp, false); if (to.x != -1) unselectHex(to); if (from.x != -1) unselectHex(to); to.set(-1, -1); from.set(-1, -1); - super.abort(); } private int buildPaths() diff --git a/core/src/ch/asynk/tankontank/game/states/GameStateSelect.java b/core/src/ch/asynk/tankontank/game/states/GameStateSelect.java index 56a1ae9..7ab4b76 100644 --- a/core/src/ch/asynk/tankontank/game/states/GameStateSelect.java +++ b/core/src/ch/asynk/tankontank/game/states/GameStateSelect.java @@ -25,9 +25,15 @@ public class GameStateSelect extends GameStateCommon public void touchUp() { if (hasPawn()) { - map.buildAndShowPossibleMoves(pawn, hex); - map.buildAndShowPossibleTargets(pawn, hex); - map.buildAndShowMoveAssist(pawn, hex); + map.enablePossibleMoves(false); + map.enablePossibleTargets(false); + map.enableMoveAssists(false); + map.buildPossibleMoves(pawn, hex); + map.buildPossibleTargets(pawn, hex); + map.buildMoveAssists(pawn, hex); + map.enablePossibleMoves(true); + map.enablePossibleTargets(true); + map.enableMoveAssists(true); } else { clear(); } @@ -44,6 +50,6 @@ public class GameStateSelect extends GameStateCommon { map.enablePossibleMoves(false); map.enablePossibleTargets(false); - map.enableMoveAssist(false); + map.enableMoveAssists(false); } } |