summaryrefslogtreecommitdiffstats
path: root/core/src/ch
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/ch')
-rw-r--r--core/src/ch/asynk/tankontank/game/Map.java36
-rw-r--r--core/src/ch/asynk/tankontank/game/states/StateAttack.java14
-rw-r--r--core/src/ch/asynk/tankontank/game/states/StateCommon.java6
-rw-r--r--core/src/ch/asynk/tankontank/game/states/StateMove.java10
-rw-r--r--core/src/ch/asynk/tankontank/game/states/StateRotate.java2
5 files changed, 24 insertions, 44 deletions
diff --git a/core/src/ch/asynk/tankontank/game/Map.java b/core/src/ch/asynk/tankontank/game/Map.java
index 4d66c1b..bc95a44 100644
--- a/core/src/ch/asynk/tankontank/game/Map.java
+++ b/core/src/ch/asynk/tankontank/game/Map.java
@@ -91,28 +91,6 @@ public abstract class Map extends Board
enableOverlayOn(hex, Hex.TARGET, enable);
}
- public void showPossibleMoves(boolean enable)
- {
- possibleMoves.enable(Hex.MOVE1, enable);
- }
-
- public void showMoveAssists(boolean enable)
- {
- moveAssists.enable(Hex.ASSIST, enable);
- }
-
- public void showAttackAssists(boolean enable)
- {
- attackAssists.enable(Hex.ASSIST, enable);
- // TODO why the above ???
- attackAssists.enable(Hex.TARGET, false);
- }
-
- public void showPossibleTargets(boolean enable)
- {
- possibleTargets.enable(Hex.TARGET, enable);
- }
-
public void showPossiblePaths(boolean enable, boolean keepFinal)
{
if (keepFinal) {
@@ -141,9 +119,9 @@ public abstract class Map extends Board
public void hidePossibleTargetsMovesAssists()
{
- showPossibleMoves(false);
- showPossibleTargets(false);
- showMoveAssists(false);
+ possibleMoves.hide();
+ possibleTargets.hide();
+ moveAssists.hide();
}
public void togglePathOverlay(Hex hex)
@@ -195,16 +173,16 @@ public abstract class Map extends Board
public void buildAndShowMovesAndAssits(Pawn pawn)
{
- showPossibleMoves(false);
- showMoveAssists(false);
+ possibleMoves.hide();
+ moveAssists.hide();
activablePawns.clear();
activatedPawns.clear();
buildPossibleMoves(pawn);
buildMoveAssists(pawn);
activablePawns.add(pawn);
moveAssists.getPawns(activablePawns);
- showPossibleMoves(true);
- showMoveAssists(true);
+ possibleMoves.show();
+ moveAssists.show();
}
public int buildPossiblePaths(Pawn pawn, Hex to)
diff --git a/core/src/ch/asynk/tankontank/game/states/StateAttack.java b/core/src/ch/asynk/tankontank/game/states/StateAttack.java
index f6d0694..e3b1cf9 100644
--- a/core/src/ch/asynk/tankontank/game/states/StateAttack.java
+++ b/core/src/ch/asynk/tankontank/game/states/StateAttack.java
@@ -1,6 +1,7 @@
package ch.asynk.tankontank.game.states;
import ch.asynk.tankontank.engine.Pawn;
+import ch.asynk.tankontank.game.Hex;
import ch.asynk.tankontank.game.State.StateType;
public class StateAttack extends StateCommon
@@ -16,9 +17,9 @@ public class StateAttack extends StateCommon
activePawn = null;
// use selectedHex and selectedPawn
from = selectedHex;
- map.showPossibleTargets(false);
+ map.possibleTargets.hide();
map.buildPossibleTargets(selectedPawn, ctrl.opponent.unitIterator());
- map.showPossibleTargets(true);
+ map.possibleTargets.show();
if (to != null) {
// quick fire -> replay touchUp
upHex = to;
@@ -31,8 +32,9 @@ public class StateAttack extends StateCommon
@Override
public void leave(StateType nextState)
{
- map.showAttackAssists(false);
- map.showPossibleTargets(false);
+ map.attackAssists.hide();
+ map.attackAssists.enable(Hex.TARGET, false); // disable selected assists
+ map.possibleTargets.hide();
map.selectHex(from, false);
if (to != null)
map.selectHex(to, false);
@@ -48,12 +50,12 @@ public class StateAttack extends StateCommon
{
// activePawn is the target
if ((activePawn == null) && map.possibleTargets.contains(upHex)) {
- map.showPossibleTargets(false);
+ map.possibleTargets.hide();
to = upHex;
activePawn = to.getTopPawn();
map.showTarget(to, true);
map.buildAttackAssists(selectedPawn, activePawn, ctrl.player.unitIterator());
- map.showAttackAssists(true);
+ map.attackAssists.show();
ctrl.hud.show(false, false, false, true, true, ctrl.cfg.canCancel);
}
diff --git a/core/src/ch/asynk/tankontank/game/states/StateCommon.java b/core/src/ch/asynk/tankontank/game/states/StateCommon.java
index 80b650f..a38d015 100644
--- a/core/src/ch/asynk/tankontank/game/states/StateCommon.java
+++ b/core/src/ch/asynk/tankontank/game/states/StateCommon.java
@@ -110,8 +110,8 @@ public abstract class StateCommon implements State
protected void showPossibleTargetsMovesAssists(Pawn pawn)
{
- if (ctrl.cfg.showMoves && pawn.canMove()) map.showPossibleMoves(true);
- if (ctrl.cfg.showTargets && pawn.canAttack()) map.showPossibleTargets(true);
- if (ctrl.cfg.showMoveAssists && pawn.canMove()) map.showMoveAssists(true);
+ if (ctrl.cfg.showMoves && pawn.canMove()) map.possibleMoves.show();
+ if (ctrl.cfg.showTargets && pawn.canAttack()) map.possibleTargets.show();
+ if (ctrl.cfg.showMoveAssists && pawn.canMove()) map.moveAssists.show();
}
}
diff --git a/core/src/ch/asynk/tankontank/game/states/StateMove.java b/core/src/ch/asynk/tankontank/game/states/StateMove.java
index cef5039..7762c92 100644
--- a/core/src/ch/asynk/tankontank/game/states/StateMove.java
+++ b/core/src/ch/asynk/tankontank/game/states/StateMove.java
@@ -38,7 +38,7 @@ public class StateMove extends StateCommon
public void leave(StateType nextState)
{
// hide all but assists : want them when in rotation
- map.showPossibleMoves(false);
+ map.possibleMoves.hide();
map.selectHex(from, false);
if (to != null) {
map.selectHex(to, false);
@@ -99,7 +99,7 @@ public class StateMove extends StateCommon
private void hideAssists()
{
map.showAssist(selectedHex, false);
- map.showMoveAssists(false);
+ map.moveAssists.hide();
}
private void changePawn(Hex next)
@@ -113,9 +113,9 @@ public class StateMove extends StateCommon
activePawn = from.getTopPawn();
map.selectHex(from, true);
map.showAssist(from, false);
- map.showPossibleMoves(false);
+ map.possibleMoves.hide();
map.buildPossibleMoves(activePawn);
- map.showPossibleMoves(true);
+ map.possibleMoves.show();
}
private int buildPaths()
@@ -123,7 +123,7 @@ public class StateMove extends StateCommon
to = upHex;
int s = map.buildPossiblePaths(activePawn, to);
map.selectHex(to, true);
- map.showPossibleMoves(false);
+ map.possibleMoves.hide();
map.showPossiblePaths(true, true);
return s;
}
diff --git a/core/src/ch/asynk/tankontank/game/states/StateRotate.java b/core/src/ch/asynk/tankontank/game/states/StateRotate.java
index 7bb3f28..86858a7 100644
--- a/core/src/ch/asynk/tankontank/game/states/StateRotate.java
+++ b/core/src/ch/asynk/tankontank/game/states/StateRotate.java
@@ -94,7 +94,7 @@ public class StateRotate extends StateCommon
private void hideAssists()
{
map.showAssist(selectedHex, false);
- map.showMoveAssists(false);
+ map.moveAssists.hide();
}
private void doRotation(Orientation o)