summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk/tankontank/game/states
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/ch/asynk/tankontank/game/states')
-rw-r--r--core/src/ch/asynk/tankontank/game/states/GameStateAnimation.java2
-rw-r--r--core/src/ch/asynk/tankontank/game/states/GameStateCommon.java16
-rw-r--r--core/src/ch/asynk/tankontank/game/states/GameStateDirection.java4
-rw-r--r--core/src/ch/asynk/tankontank/game/states/GameStateMove.java6
-rw-r--r--core/src/ch/asynk/tankontank/game/states/GameStateRotate.java8
-rw-r--r--core/src/ch/asynk/tankontank/game/states/GameStateView.java2
6 files changed, 14 insertions, 24 deletions
diff --git a/core/src/ch/asynk/tankontank/game/states/GameStateAnimation.java b/core/src/ch/asynk/tankontank/game/states/GameStateAnimation.java
index c4a2dd8..435a066 100644
--- a/core/src/ch/asynk/tankontank/game/states/GameStateAnimation.java
+++ b/core/src/ch/asynk/tankontank/game/states/GameStateAnimation.java
@@ -20,7 +20,7 @@ public class GameStateAnimation extends GameStateCommon
@Override
public void abort()
{
- unselectHex();
+ unselectHex(hex);
pawn = null;
super.abort();
}
diff --git a/core/src/ch/asynk/tankontank/game/states/GameStateCommon.java b/core/src/ch/asynk/tankontank/game/states/GameStateCommon.java
index 4653518..94ec4af 100644
--- a/core/src/ch/asynk/tankontank/game/states/GameStateCommon.java
+++ b/core/src/ch/asynk/tankontank/game/states/GameStateCommon.java
@@ -68,31 +68,21 @@ public abstract class GameStateCommon implements GameState
return (pawn != null);
}
- protected void unselectHex()
- {
- unselectHex(hex);
- }
-
protected void unselectHex(GridPoint2 hex)
{
map.enableOverlayOn(hex, Hex.BLUE, false);
}
- protected void selectHex()
- {
- selectHex(hex);
- }
-
protected void selectHex(GridPoint2 hex)
{
map.enableOverlayOn(hex, Hex.BLUE, true);
}
- protected void reselect()
+ protected void reselectHex()
{
- unselectHex();
+ unselectHex(hex);
setHexAndPawn(downHex);
- selectHex();
+ selectHex(hex);
}
protected boolean sameHexes(GridPoint2 a, GridPoint2 b)
diff --git a/core/src/ch/asynk/tankontank/game/states/GameStateDirection.java b/core/src/ch/asynk/tankontank/game/states/GameStateDirection.java
index c82b96b..658c70a 100644
--- a/core/src/ch/asynk/tankontank/game/states/GameStateDirection.java
+++ b/core/src/ch/asynk/tankontank/game/states/GameStateDirection.java
@@ -22,9 +22,9 @@ public class GameStateDirection extends GameStateCommon
if (o != Orientation.KEEP) {
map.movePawn(pawn, o);
clear();
- unselectHex();
+ unselectHex(hex);
hex.set(tmp.x, tmp.y);
- unselectHex();
+ unselectHex(hex);
ctrl.setState(State.ANIMATION);
}
}
diff --git a/core/src/ch/asynk/tankontank/game/states/GameStateMove.java b/core/src/ch/asynk/tankontank/game/states/GameStateMove.java
index daf5b3c..bb992c3 100644
--- a/core/src/ch/asynk/tankontank/game/states/GameStateMove.java
+++ b/core/src/ch/asynk/tankontank/game/states/GameStateMove.java
@@ -10,7 +10,7 @@ public class GameStateMove extends GameStateCommon
map.enablePossibleTargets(false);
map.enablePossiblePaths(false, false);
if (hasPawn()) {
- selectHex();
+ selectHex(hex);
skipFirst = false;
map.clearPossiblePaths();
map.buildAndShowPossibleMoves(pawn, hex);
@@ -22,7 +22,7 @@ public class GameStateMove extends GameStateCommon
public void touchDown()
{
if (!hasPawn()) {
- reselect();
+ reselect(hex);
if (hasPawn()) {
skipFirst = true;
map.clearPossiblePaths();
@@ -36,7 +36,7 @@ public class GameStateMove extends GameStateCommon
public void touchUp()
{
if (!hasPawn()) {
- unselectHex();
+ unselectHex(hex);
return;
}
diff --git a/core/src/ch/asynk/tankontank/game/states/GameStateRotate.java b/core/src/ch/asynk/tankontank/game/states/GameStateRotate.java
index d4bf2ae..661efa7 100644
--- a/core/src/ch/asynk/tankontank/game/states/GameStateRotate.java
+++ b/core/src/ch/asynk/tankontank/game/states/GameStateRotate.java
@@ -9,7 +9,7 @@ public class GameStateRotate extends GameStateCommon
{
map.hidePossibles();
if (hasPawn()) {
- selectHex();
+ selectHex(hex);
map.enableDirections(hex, true);
}
}
@@ -18,7 +18,7 @@ public class GameStateRotate extends GameStateCommon
public void touchDown()
{
if (!hasPawn()) {
- reselect();
+ reselectHex();
if (hasPawn()) {
map.enableDirections(hex, true);
}
@@ -29,14 +29,14 @@ public class GameStateRotate extends GameStateCommon
public void touchUp()
{
if (!hasPawn()) {
- unselectHex();
+ unselectHex(hex);
return;
}
Orientation o = Orientation.fromAdj(hex.x, hex.y, downHex.x, downHex.y);
if (o != Orientation.KEEP) {
- unselectHex();
+ unselectHex(hex);
map.enableDirections(hex, false);
if (pawn.getOrientation() != o) {
map.rotatePawn(pawn, o);
diff --git a/core/src/ch/asynk/tankontank/game/states/GameStateView.java b/core/src/ch/asynk/tankontank/game/states/GameStateView.java
index 9313bc9..fc67ccb 100644
--- a/core/src/ch/asynk/tankontank/game/states/GameStateView.java
+++ b/core/src/ch/asynk/tankontank/game/states/GameStateView.java
@@ -18,7 +18,7 @@ public class GameStateView extends GameStateCommon
@Override
public void touchDown()
{
- reselect();
+ reselectHex();
}
@Override