summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk/tankontank/game/states
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-11-05 17:20:34 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2014-11-05 17:20:34 +0100
commitce6ad7da0c330dd839a68dd9b42fcf0a04b0f09e (patch)
tree60362fe858a658b9e60a7850d34be851df6117b8 /core/src/ch/asynk/tankontank/game/states
parent0694ea23fcd9c51b79717975ec4ec6467739ad52 (diff)
downloadRustAndDust-ce6ad7da0c330dd839a68dd9b42fcf0a04b0f09e.zip
RustAndDust-ce6ad7da0c330dd839a68dd9b42fcf0a04b0f09e.tar.gz
add game/states/StateEntry
Diffstat (limited to 'core/src/ch/asynk/tankontank/game/states')
-rw-r--r--core/src/ch/asynk/tankontank/game/states/StateEntry.java69
1 files changed, 69 insertions, 0 deletions
diff --git a/core/src/ch/asynk/tankontank/game/states/StateEntry.java b/core/src/ch/asynk/tankontank/game/states/StateEntry.java
new file mode 100644
index 0000000..dc4acc9
--- /dev/null
+++ b/core/src/ch/asynk/tankontank/game/states/StateEntry.java
@@ -0,0 +1,69 @@
+package ch.asynk.tankontank.game.states;
+
+import com.badlogic.gdx.math.Vector3;
+
+import ch.asynk.tankontank.engine.TileSet;
+import ch.asynk.tankontank.engine.Orientation;
+import ch.asynk.tankontank.game.Hex;
+
+public class StateEntry extends StateCommon
+{
+ private float x;
+ private float y;
+ private float z;
+ private TileSet entryPoint;
+
+ @Override
+ public void enter(boolean fromSelect)
+ {
+ activeUnit = ctrl.hud.getDockUnit();
+ entryPoint = ctrl.battle.getEntryPoint(activeUnit);
+ entryPoint.enable(Hex.AREA, true);
+ ctrl.hud.show(false, false, false, false, false, ctrl.cfg.canCancel);
+ x = activeUnit.getPosition().x;
+ y = activeUnit.getPosition().x;
+ z = activeUnit.getPosition().y;
+ }
+
+ @Override
+ public void leave(StateType nextState)
+ {
+ entryPoint.enable(Hex.AREA, false);
+ ctrl.hud.hideUnitDock();
+ }
+
+ @Override
+ public void touchDown()
+ {
+ }
+
+ @Override
+ public void touchUp()
+ {
+ if (upHex.isEmpty() && entryPoint.contains(upHex)) {
+ selectedUnit = activeUnit;
+ selectedHex = upHex;
+ map.selectHex(selectedHex);
+ entryPoint.enable(Hex.AREA, false);
+ ctrl.player.unitEntry(activeUnit);
+ map.enterBoard(activeUnit, upHex, ctrl.battle.getEntryOrientation(ctrl.player));
+ if (activeUnit.getMovementPoints() > 0)
+ ctrl.setState(StateType.MOVE, true);
+ else
+ ctrl.setState(StateType.ROTATE, true);
+ }
+ }
+
+ @Override
+ public void abort()
+ {
+ activeUnit.setPosition(x, y, z);
+ super.abort();
+ }
+
+ @Override
+ public void done()
+ {
+ super.done();
+ }
+}