summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2015-12-09 22:56:18 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2015-12-09 22:56:18 +0100
commit01994a6fd401afec6910fe8b0814eee5530cbf79 (patch)
tree7380eba6df86e8f5e190337606b1b4a53175c317
parent371383241f048a01456c7e832ef12335900fcb2a (diff)
downloadRustAndDust-01994a6fd401afec6910fe8b0814eee5530cbf79.zip
RustAndDust-01994a6fd401afec6910fe8b0814eee5530cbf79.tar.gz
Ctrl: code reorder
-rw-r--r--core/src/ch/asynk/rustanddust/game/Ctrl.java78
1 files changed, 40 insertions, 38 deletions
diff --git a/core/src/ch/asynk/rustanddust/game/Ctrl.java b/core/src/ch/asynk/rustanddust/game/Ctrl.java
index 1be23f9..31f1b3e 100644
--- a/core/src/ch/asynk/rustanddust/game/Ctrl.java
+++ b/core/src/ch/asynk/rustanddust/game/Ctrl.java
@@ -206,51 +206,17 @@ public class Ctrl implements Disposable
}
}
- private StateType actionAborted()
- {
- hud.notify("Action canceled");
- StateType nextState = this.state.abort();
-
- if (nextState == StateType.ABORT)
- nextState = battle.getState();
-
- return nextState;
- }
-
- private StateType actionDone()
- {
- StateType nextState = this.state.execute();
-
- if (nextState == StateType.DONE) {
- if (battle.actionDone()) {
- hud.notify("1 Action Point burnt", 0.6f, Position.BOTTOM_CENTER, false);
- hud.update();
- }
- if (battle.getPlayer().apExhausted())
- hud.notifyNoMoreAP();
- }
-
- if (nextState == StateType.DONE)
- nextState = battle.getState();
-
- return nextState;
- }
-
- private StateType deploymentDone()
- {
- battle.actionDone();
- return this.state.execute();
- }
+ //
public void setState(StateType nextState)
{
if (nextState == StateType.ABORT)
- nextState = actionAborted();
+ nextState = abortAction();
else if (nextState == StateType.DONE) {
if (stateType == StateType.DEPLOYMENT)
- nextState = deploymentDone();
+ nextState = completeDeployment();
else
- nextState = actionDone();
+ nextState = completeAction();
}
if (stateType == StateType.ANIMATION) {
@@ -304,4 +270,40 @@ public class Ctrl implements Disposable
this.state.enter(tmp);
}
+
+ private StateType completeDeployment()
+ {
+ battle.actionDone();
+ return this.state.execute();
+ }
+
+ private StateType abortAction()
+ {
+ hud.notify("Action canceled");
+ StateType nextState = this.state.abort();
+
+ if (nextState == StateType.ABORT)
+ nextState = battle.getState();
+
+ return nextState;
+ }
+
+ private StateType completeAction()
+ {
+ StateType nextState = this.state.execute();
+
+ if (nextState == StateType.DONE) {
+ if (battle.actionDone()) {
+ hud.notify("1 Action Point burnt", 0.6f, Position.BOTTOM_CENTER, false);
+ hud.update();
+ }
+ if (battle.getPlayer().apExhausted())
+ hud.notifyNoMoreAP();
+ }
+
+ if (nextState == StateType.DONE)
+ nextState = battle.getState();
+
+ return nextState;
+ }
}