From cb8e7a5f09fadca472910fc435c307e2cff77aac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Tue, 7 Oct 2014 20:57:13 +0200 Subject: GameStateMove: show assist moves, clear correctly --- core/src/ch/asynk/tankontank/game/states/GameStateMove.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/core/src/ch/asynk/tankontank/game/states/GameStateMove.java b/core/src/ch/asynk/tankontank/game/states/GameStateMove.java index bc6e535..daf5b3c 100644 --- a/core/src/ch/asynk/tankontank/game/states/GameStateMove.java +++ b/core/src/ch/asynk/tankontank/game/states/GameStateMove.java @@ -1,12 +1,8 @@ package ch.asynk.tankontank.game.states; -import com.badlogic.gdx.math.GridPoint2; - public class GameStateMove extends GameStateCommon { private boolean skipFirst; - private GridPoint2 from = new GridPoint2(-1, -1); - private GridPoint2 to = new GridPoint2(-1, -1); @Override public void enter() @@ -18,6 +14,7 @@ public class GameStateMove extends GameStateCommon skipFirst = false; map.clearPossiblePaths(); map.buildAndShowPossibleMoves(pawn, hex); + map.buildAndShowMoveAssist(pawn, hex); } } @@ -30,6 +27,7 @@ public class GameStateMove extends GameStateCommon skipFirst = true; map.clearPossiblePaths(); map.buildAndShowPossibleMoves(pawn, hex); + map.buildAndShowMoveAssist(pawn, hex); } } } @@ -67,6 +65,10 @@ public class GameStateMove extends GameStateCommon @Override public void abort() { + map.enableMoveAssist(false); + map.enablePossibleMoves(false); + if (to.x != -1) unselectHex(to); + if (from.x != -1) unselectHex(to); to.set(-1, -1); from.set(-1, -1); super.abort(); @@ -78,7 +80,7 @@ public class GameStateMove extends GameStateCommon to.set(upHex.x, upHex.y); map.clearPossiblePaths(); int s = map.buildPossiblePaths(pawn, from, to); - selectHex(downHex); + selectHex(to); map.enablePossibleMoves(false); map.enablePossiblePaths(true, true); return s; -- cgit v1.1-2-g2b99