From ad9fe393fd55ce1b30a043882dc6731758bec84c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Wed, 8 Oct 2014 09:40:36 +0200 Subject: GameStase*: update according to Map .possible .assits API --- .../tankontank/game/states/GameStateDirection.java | 2 +- .../tankontank/game/states/GameStateMove.java | 26 +++++++++++++++++----- .../tankontank/game/states/GameStateSelect.java | 14 ++++++++---- 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); } } -- cgit v1.1-2-g2b99