summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-11-13 23:50:16 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2014-11-13 23:50:16 +0100
commite160da96291ea1bca896e30237fce070ef296667 (patch)
tree21515ccb2eb08f00d860ee18fbcb478d0745e923
parent0c5e832a7f5778b8fe7072de165a6296eeda0308 (diff)
downloadRustAndDust-e160da96291ea1bca896e30237fce070ef296667.zip
RustAndDust-e160da96291ea1bca896e30237fce070ef296667.tar.gz
Ctrl: split nextPlayer() -> swicthPlayer() endPlayerTurn() startPlayerTurn()
-rw-r--r--core/src/ch/asynk/tankontank/game/Ctrl.java31
1 files changed, 17 insertions, 14 deletions
diff --git a/core/src/ch/asynk/tankontank/game/Ctrl.java b/core/src/ch/asynk/tankontank/game/Ctrl.java
index 79bb606..5d4524b 100644
--- a/core/src/ch/asynk/tankontank/game/Ctrl.java
+++ b/core/src/ch/asynk/tankontank/game/Ctrl.java
@@ -108,21 +108,30 @@ public class Ctrl implements Disposable
TankOnTank.debug(" animationCount < 0");
}
- private void nextPlayer()
+ private void startPlayerTurn()
+ {
+ player.turnStart();
+ hud.playerInfo.update(player, battle.getHudPosition(player));
+ setState(battle.getState(player));
+ hud.notify(player.getName() + "'s turn", 2, Position.MIDDLE_CENTER, true);
+ }
+
+ private void endPlayerTurn()
{
TankOnTank.debug("Ctrl", "next Player");
player.turnEnd();
Player winner = battle.checkVictory(this);
- if (winner != null) {
+ if (winner != null)
hud.victory(winner, ((winner == player) ? opponent : player));
- }
+ }
+
+ private void swicthPlayer()
+ {
+ endPlayerTurn();
Player tmp = player;
player = opponent;
opponent = tmp;
- player.turnStart();
- hud.playerInfo.update(player, battle.getHudPosition(player));
- hud.notify(player.getName() + "'s turn");
- setState(battle.getState(player));
+ startPlayerTurn();
}
private void checkTurnEnd()
@@ -132,13 +141,7 @@ public class Ctrl implements Disposable
hud.playerInfo.update(player, battle.getHudPosition(player));
}
if (player.apExhausted())
- nextPlayer();
- }
-
- public void endPlayerTurn()
- {
- state.abort();
- nextPlayer();
+ swicthPlayer();
}
public void stateTouchUp()