From 85eda8c5bedf7f77cdb225bd5bba25fe4af721fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Wed, 8 Oct 2014 09:02:24 +0200 Subject: GameStateView -> GameStateSelect --- core/src/ch/asynk/tankontank/game/GameCtrl.java | 12 +++--- .../tankontank/game/states/GameStateSelect.java | 49 ++++++++++++++++++++++ .../tankontank/game/states/GameStateView.java | 49 ---------------------- 3 files changed, 55 insertions(+), 55 deletions(-) create mode 100644 core/src/ch/asynk/tankontank/game/states/GameStateSelect.java delete mode 100644 core/src/ch/asynk/tankontank/game/states/GameStateView.java diff --git a/core/src/ch/asynk/tankontank/game/GameCtrl.java b/core/src/ch/asynk/tankontank/game/GameCtrl.java index 9c39ef8..3d895d4 100644 --- a/core/src/ch/asynk/tankontank/game/GameCtrl.java +++ b/core/src/ch/asynk/tankontank/game/GameCtrl.java @@ -4,7 +4,7 @@ import com.badlogic.gdx.utils.Disposable; import ch.asynk.tankontank.TankOnTank; import ch.asynk.tankontank.game.states.GameStateCommon; -import ch.asynk.tankontank.game.states.GameStateView; +import ch.asynk.tankontank.game.states.GameStateSelect; import ch.asynk.tankontank.game.states.GameStateMove; import ch.asynk.tankontank.game.states.GameStateDirection; import ch.asynk.tankontank.game.states.GameStateRotate; @@ -18,7 +18,7 @@ public class GameCtrl implements Disposable public Map map; public Hud hud; - private GameState viewState; + private GameState selectState; private GameState pathState; private GameState directionState; private GameState rotateState; @@ -34,13 +34,13 @@ public class GameCtrl implements Disposable this.hud = new Hud(this, game); this.map = factory.getMap(this, game.manager, GameFactory.MapType.MAP_A); - this.viewState = new GameStateView(this, map); + this.selectState = new GameStateSelect(this, map); this.pathState = new GameStateMove(); this.directionState = new GameStateDirection(); this.rotateState = new GameStateRotate(); this.animationState = new GameStateAnimation(); - this.state = viewState; + this.state = selectState; factory.fakeSetup(map); } @@ -60,7 +60,7 @@ public class GameCtrl implements Disposable public boolean isInAction() { - return (state != viewState); + return (state != selectState); } public void animationDone() @@ -73,7 +73,7 @@ public class GameCtrl implements Disposable { switch(state) { case VIEW: - this.state = viewState; + this.state = selectState; break; case MOVE: this.state = pathState; diff --git a/core/src/ch/asynk/tankontank/game/states/GameStateSelect.java b/core/src/ch/asynk/tankontank/game/states/GameStateSelect.java new file mode 100644 index 0000000..abf868c --- /dev/null +++ b/core/src/ch/asynk/tankontank/game/states/GameStateSelect.java @@ -0,0 +1,49 @@ +package ch.asynk.tankontank.game.states; + +import ch.asynk.tankontank.game.Map; +import ch.asynk.tankontank.game.GameCtrl; + +public class GameStateSelect extends GameStateCommon +{ + public GameStateSelect(GameCtrl ctrl, Map map) + { + super(ctrl, map); + } + + @Override + public void enter() + { + } + + @Override + public void touchDown() + { + reselect(hex); + } + + @Override + public void touchUp() + { + if (hasPawn()) { + map.buildAndShowPossibleMoves(pawn, hex); + map.buildAndShowPossibleTargets(pawn, hex); + map.buildAndShowMoveAssist(pawn, hex); + } else { + clear(); + } + } + + @Override + public void abort() + { + clear(); + super.abort(); + } + + private void clear() + { + map.enablePossibleMoves(false); + map.enablePossibleTargets(false); + map.enableMoveAssist(false); + } +} diff --git a/core/src/ch/asynk/tankontank/game/states/GameStateView.java b/core/src/ch/asynk/tankontank/game/states/GameStateView.java deleted file mode 100644 index fc67ccb..0000000 --- a/core/src/ch/asynk/tankontank/game/states/GameStateView.java +++ /dev/null @@ -1,49 +0,0 @@ -package ch.asynk.tankontank.game.states; - -import ch.asynk.tankontank.game.Map; -import ch.asynk.tankontank.game.GameCtrl; - -public class GameStateView extends GameStateCommon -{ - public GameStateView(GameCtrl ctrl, Map map) - { - super(ctrl, map); - } - - @Override - public void enter() - { - } - - @Override - public void touchDown() - { - reselectHex(); - } - - @Override - public void touchUp() - { - if (hasPawn()) { - map.buildAndShowPossibleMoves(pawn, hex); - map.buildAndShowPossibleTargets(pawn, hex); - map.buildAndShowMoveAssist(pawn, hex); - } else { - clear(); - } - } - - @Override - public void abort() - { - clear(); - super.abort(); - } - - private void clear() - { - map.enablePossibleMoves(false); - map.enablePossibleTargets(false); - map.enableMoveAssist(false); - } -} -- cgit v1.1-2-g2b99