diff options
Diffstat (limited to 'core/src/ch')
-rw-r--r-- | core/src/ch/asynk/tankontank/game/hud/PlayerInfo.java | 4 | ||||
-rw-r--r-- | core/src/ch/asynk/tankontank/game/hud/UnitDock.java | 15 |
2 files changed, 11 insertions, 8 deletions
diff --git a/core/src/ch/asynk/tankontank/game/hud/PlayerInfo.java b/core/src/ch/asynk/tankontank/game/hud/PlayerInfo.java index 24f07b8..45ee5dc 100644 --- a/core/src/ch/asynk/tankontank/game/hud/PlayerInfo.java +++ b/core/src/ch/asynk/tankontank/game/hud/PlayerInfo.java @@ -162,8 +162,10 @@ public class PlayerInfo implements Disposable, Drawable, Animation ctrl.reinforcementHit(); } else if (hit == unitDock) { - if (unitDock.hit(x, y)) + if (unitDock.hit(x, y)) { + ctrl.hud.notify(unitDock.select(x, y).toString()); ctrl.stateTouchUp(); + } } hit = null; diff --git a/core/src/ch/asynk/tankontank/game/hud/UnitDock.java b/core/src/ch/asynk/tankontank/game/hud/UnitDock.java index 39041cc..05824e0 100644 --- a/core/src/ch/asynk/tankontank/game/hud/UnitDock.java +++ b/core/src/ch/asynk/tankontank/game/hud/UnitDock.java @@ -92,13 +92,14 @@ public class UnitDock extends Bg implements Animation @Override public boolean hit(float x, float y) { - if (visible && scaledRect.contains(x, y)) { - int i = (int) ((scaledRect.y + scaledRect.height - y) / (scaledRect.height / units.size())); - selectedUnit = units.get(i); - ctrl.hud.notify(selectedUnit.toString()); - return true; - } - return false; + return (visible && scaledRect.contains(x, y)); + } + + public Unit select(float x, float y) + { + int i = (int) ((scaledRect.y + scaledRect.height - y) / (scaledRect.height / units.size())); + selectedUnit = units.get(i); + return selectedUnit; } public void hide() |