From d2737a89a46694622e9206ac1704f23f9601d2ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Wed, 19 Nov 2014 10:17:03 +0100 Subject: StatePromote: use Player.promote(), set activatedPawns, unselect on leave --- core/src/ch/asynk/tankontank/game/states/StatePromote.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/core/src/ch/asynk/tankontank/game/states/StatePromote.java b/core/src/ch/asynk/tankontank/game/states/StatePromote.java index cf628d9..3d83ec3 100644 --- a/core/src/ch/asynk/tankontank/game/states/StatePromote.java +++ b/core/src/ch/asynk/tankontank/game/states/StatePromote.java @@ -8,19 +8,18 @@ public class StatePromote extends StateCommon public void enter(StateType prevState) { ctrl.hud.actionButtons.hide(); - Unit unit = ctrl.player.promote(selectedUnit); - if (unit != null) { - // TODO this must burn 1 AP down !!!!! - ctrl.hud.notify(unit + " has been promoted"); - selectedUnit.promote(); - unit.degrade(); + String str = selectedUnit.toString(); + if (ctrl.player.promote(selectedUnit)) { + map.activatedPawns.add(selectedUnit); + ctrl.hud.notify(str+ " has been promoted"); } - done(); + ctrl.setState(StateType.DONE); } @Override public void leave(StateType nextState) { + map.unselectHex(selectedHex); } @Override -- cgit v1.1-2-g2b99