summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk/rustanddust/game/states
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2015-12-15 11:22:09 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2015-12-15 11:22:09 +0100
commit2aaa0def4ec621f159c3c754523e479ac5f16b28 (patch)
tree90be65a362c80b18d77d80f54bf6a8d096aa6a23 /core/src/ch/asynk/rustanddust/game/states
parentcd60dc64883719edc735f6bea7c37e97470b180a (diff)
downloadRustAndDust-2aaa0def4ec621f159c3c754523e479ac5f16b28.zip
RustAndDust-2aaa0def4ec621f159c3c754523e479ac5f16b28.tar.gz
StateDeployment: code cleanup
Diffstat (limited to 'core/src/ch/asynk/rustanddust/game/states')
-rw-r--r--core/src/ch/asynk/rustanddust/game/states/StateDeployment.java33
1 files changed, 17 insertions, 16 deletions
diff --git a/core/src/ch/asynk/rustanddust/game/states/StateDeployment.java b/core/src/ch/asynk/rustanddust/game/states/StateDeployment.java
index 9d5de19..b224e2e 100644
--- a/core/src/ch/asynk/rustanddust/game/states/StateDeployment.java
+++ b/core/src/ch/asynk/rustanddust/game/states/StateDeployment.java
@@ -66,16 +66,15 @@ public class StateDeployment extends StateCommon
if (!completed && (unit != null) && (unit != activeUnit)) {
showEntryZone(unit);
} else if (selectedUnit != null) {
- doRotation(Orientation.fromAdj(selectedHex, upHex));
+ deployUnit(Orientation.fromAdj(selectedHex, upHex));
} else if (!completed && (entryZone != null) && (upHex != null)) {
- if (upHex.isEmpty() && entryZone.contains(upHex))
- unitEnter(activeUnit);
- } else {
- unit = downHex.getUnit();
- if (deployedUnits.contains(unit)) {
- showRotation(unit, downHex);
- activeUnit = unit;
+ if (upHex.isEmpty() && entryZone.contains(upHex)) {
+ showUnit(activeUnit, upHex);
}
+ } else {
+ unit = upHex.getUnit();
+ if (deployedUnits.contains(unit))
+ showRotation(unit, upHex);
}
}
@@ -97,10 +96,10 @@ public class StateDeployment extends StateCommon
ctrl.hud.update();
}
- private void unitEnter(Unit unit)
+ private void showUnit(Unit unit, Hex hex)
{
selectedUnit = unit;
- selectedHex = upHex;
+ selectedHex = hex;
ctrl.battle.getPlayer().reinforcement.remove(unit);
map.showOnBoard(unit, upHex, entryZone.orientation);
deployedUnits.add(unit);
@@ -111,6 +110,7 @@ public class StateDeployment extends StateCommon
private void showRotation(Unit unit, Hex hex)
{
+ activeUnit = unit;
selectedUnit = unit;
selectedHex = hex;
map.hexSelect(selectedHex);
@@ -119,19 +119,20 @@ public class StateDeployment extends StateCommon
ctrl.hud.actionButtons.show(Buttons.ABORT.b);
}
- private void doRotation(Orientation o)
+ private void deployUnit(Orientation o)
{
- map.hexUnselect(selectedHex);
- map.hexDirectionsHide(selectedHex);
- map.revertEnter(selectedUnit);
if (o == Orientation.KEEP)
o = selectedUnit.getOrientation();
+ map.revertEnter(selectedUnit);
map.setOnBoard(selectedUnit, selectedHex, o);
- ctrl.hud.actionButtons.hide();
- ctrl.hud.playerInfo.unitDock.show();
+
entryZone = null;
activeUnit = null;
selectedUnit = null;
+ map.hexUnselect(selectedHex);
+ map.hexDirectionsHide(selectedHex);
+ ctrl.hud.actionButtons.hide();
+ ctrl.hud.playerInfo.unitDock.show();
if (ctrl.checkDeploymentDone())
completed = true;
}