diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2014-10-12 11:55:52 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2014-10-12 11:55:52 +0200 |
commit | 3afc38971c4d7cbbea48128c930f00d5734a529f (patch) | |
tree | a7459a38e5d7bb9eafb739f6e8be2e347bcc99c9 /core/src/ch/asynk/tankontank/game/states | |
parent | a745392ca2863e2f5036207e5c4a75e851016737 (diff) | |
download | RustAndDust-3afc38971c4d7cbbea48128c930f00d5734a529f.zip RustAndDust-3afc38971c4d7cbbea48128c930f00d5734a529f.tar.gz |
GameState* -> State
Diffstat (limited to 'core/src/ch/asynk/tankontank/game/states')
-rw-r--r-- | core/src/ch/asynk/tankontank/game/states/StateAnimation.java (renamed from core/src/ch/asynk/tankontank/game/states/GameStateAnimation.java) | 8 | ||||
-rw-r--r-- | core/src/ch/asynk/tankontank/game/states/StateCommon.java (renamed from core/src/ch/asynk/tankontank/game/states/GameStateCommon.java) | 21 | ||||
-rw-r--r-- | core/src/ch/asynk/tankontank/game/states/StateMove.java (renamed from core/src/ch/asynk/tankontank/game/states/GameStateMove.java) | 10 | ||||
-rw-r--r-- | core/src/ch/asynk/tankontank/game/states/StateRotate.java (renamed from core/src/ch/asynk/tankontank/game/states/GameStateRotate.java) | 14 | ||||
-rw-r--r-- | core/src/ch/asynk/tankontank/game/states/StateSelect.java (renamed from core/src/ch/asynk/tankontank/game/states/GameStateSelect.java) | 10 |
5 files changed, 32 insertions, 31 deletions
diff --git a/core/src/ch/asynk/tankontank/game/states/GameStateAnimation.java b/core/src/ch/asynk/tankontank/game/states/StateAnimation.java index e1b2c08..753cbf8 100644 --- a/core/src/ch/asynk/tankontank/game/states/GameStateAnimation.java +++ b/core/src/ch/asynk/tankontank/game/states/StateAnimation.java @@ -1,8 +1,8 @@ package ch.asynk.tankontank.game.states; -import ch.asynk.tankontank.game.GameState.State; +import ch.asynk.tankontank.game.State.StateType; -public class GameStateAnimation extends GameStateCommon +public class StateAnimation extends StateCommon { @Override public void enter(boolean flag) @@ -10,9 +10,9 @@ public class GameStateAnimation extends GameStateCommon } @Override - public void leave(State nextState) + public void leave(StateType nextState) { - if (nextState != State.SELECT) { + if (nextState != StateType.SELECT) { from.set(-1, -1); to.set(-1, -1); } diff --git a/core/src/ch/asynk/tankontank/game/states/GameStateCommon.java b/core/src/ch/asynk/tankontank/game/states/StateCommon.java index a759dc2..8d7a48d 100644 --- a/core/src/ch/asynk/tankontank/game/states/GameStateCommon.java +++ b/core/src/ch/asynk/tankontank/game/states/StateCommon.java @@ -6,9 +6,10 @@ import ch.asynk.tankontank.engine.Pawn; import ch.asynk.tankontank.game.Map; import ch.asynk.tankontank.game.Hex; import ch.asynk.tankontank.game.Ctrl; -import ch.asynk.tankontank.game.GameState; +import ch.asynk.tankontank.game.State; +import ch.asynk.tankontank.game.State.StateType; -public abstract class GameStateCommon implements GameState +public abstract class StateCommon implements State { protected static Ctrl ctrl; protected static Map map; @@ -23,26 +24,26 @@ public abstract class GameStateCommon implements GameState protected boolean isEnemy; - protected static GameState.State nextState = GameState.State.SELECT; + protected static StateType nextState = StateType.SELECT; - protected GameStateCommon() + protected StateCommon() { } - public GameStateCommon(Ctrl ctrl, Map map) + public StateCommon(Ctrl ctrl, Map map) { this.ctrl = ctrl; this.map = map; } @Override - public GameState.State getNextState() + public StateType getNextState() { return nextState; } @Override - public void setNextState(GameState.State state) + public void setNextState(StateType state) { nextState = state; } @@ -71,9 +72,9 @@ public abstract class GameStateCommon implements GameState private void goToNextState() { ctrl.hud.hide(); - GameState.State next = nextState; - nextState = GameState.State.SELECT; - ctrl.setState(next, (next == GameState.State.SELECT)); + StateType next = nextState; + nextState = StateType.SELECT; + ctrl.setState(next, (next == StateType.SELECT)); } protected static boolean hexInMap(GridPoint2 hex) diff --git a/core/src/ch/asynk/tankontank/game/states/GameStateMove.java b/core/src/ch/asynk/tankontank/game/states/StateMove.java index 56a81a3..2038855 100644 --- a/core/src/ch/asynk/tankontank/game/states/GameStateMove.java +++ b/core/src/ch/asynk/tankontank/game/states/StateMove.java @@ -2,9 +2,9 @@ package ch.asynk.tankontank.game.states; import com.badlogic.gdx.math.GridPoint2; -import ch.asynk.tankontank.game.GameState.State; +import ch.asynk.tankontank.game.State.StateType; -public class GameStateMove extends GameStateCommon +public class StateMove extends StateCommon { @Override public void enter(boolean fromSelect) @@ -36,7 +36,7 @@ public class GameStateMove extends GameStateCommon } @Override - public void leave(State nextState) + public void leave(StateType nextState) { // hide all but assists : want them when in rotation map.showPossibleMoves(false); @@ -46,7 +46,7 @@ public class GameStateMove extends GameStateCommon map.showFinalPath(to, false); } - if (nextState != State.SELECT) { + if (nextState != StateType.SELECT) { if (to.x == -1 ) to.set(from); } @@ -75,7 +75,7 @@ public class GameStateMove extends GameStateCommon // prevent changePawn if (sameHexes(from, selectedHex)) selectedHex.set(to); - ctrl.setState(State.ROTATE, false); + ctrl.setState(StateType.ROTATE, false); } } diff --git a/core/src/ch/asynk/tankontank/game/states/GameStateRotate.java b/core/src/ch/asynk/tankontank/game/states/StateRotate.java index a57ecb3..f692ed0 100644 --- a/core/src/ch/asynk/tankontank/game/states/GameStateRotate.java +++ b/core/src/ch/asynk/tankontank/game/states/StateRotate.java @@ -1,9 +1,9 @@ package ch.asynk.tankontank.game.states; import ch.asynk.tankontank.engine.Orientation; -import ch.asynk.tankontank.game.GameState.State; +import ch.asynk.tankontank.game.State.StateType; -public class GameStateRotate extends GameStateCommon +public class StateRotate extends StateCommon { private boolean rotateOnly; private boolean rotationSet; @@ -38,7 +38,7 @@ public class GameStateRotate extends GameStateCommon } @Override - public void leave(State nextState) + public void leave(StateType nextState) { unselectHex(to); unselectHex(from); @@ -102,13 +102,13 @@ public class GameStateRotate extends GameStateCommon if (rotateOnly) { ctrl.setAnimationCount(1); if (map.rotatePawn(activePawn, from, o) > 0) - setNextState(State.MOVE); - ctrl.setState(State.ANIMATION); + setNextState(StateType.MOVE); + ctrl.setState(StateType.ANIMATION); } else { ctrl.setAnimationCount(1); if (map.movePawn(activePawn, from, o) > 0) - setNextState(State.MOVE); - ctrl.setState(State.ANIMATION); + setNextState(StateType.MOVE); + ctrl.setState(StateType.ANIMATION); } } } diff --git a/core/src/ch/asynk/tankontank/game/states/GameStateSelect.java b/core/src/ch/asynk/tankontank/game/states/StateSelect.java index 711daae..ec1ba42 100644 --- a/core/src/ch/asynk/tankontank/game/states/GameStateSelect.java +++ b/core/src/ch/asynk/tankontank/game/states/StateSelect.java @@ -2,11 +2,11 @@ package ch.asynk.tankontank.game.states; import ch.asynk.tankontank.game.Map; import ch.asynk.tankontank.game.Ctrl; -import ch.asynk.tankontank.game.GameState.State; +import ch.asynk.tankontank.game.State.StateType; -public class GameStateSelect extends GameStateCommon +public class StateSelect extends StateCommon { - public GameStateSelect(Ctrl ctrl, Map map) + public StateSelect(Ctrl ctrl, Map map) { super(ctrl, map); } @@ -19,7 +19,7 @@ public class GameStateSelect extends GameStateCommon } @Override - public void leave(State nextState) + public void leave(StateType nextState) { hidePossibleTargetsMovesAssists(); } @@ -36,7 +36,7 @@ public class GameStateSelect extends GameStateCommon if (!isEnemy && map.isInPossibleMoves(upHex)) { // quick move to.set(upHex); - ctrl.setState(State.MOVE); + ctrl.setState(StateType.MOVE); return; } |