diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2015-02-19 16:52:14 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2015-02-19 16:52:14 +0100 |
commit | cbe4077b975abbceb508c41b33523e1aafac8594 (patch) | |
tree | b13b024f7d79e70acfd684ed0d405b09b05db9b3 | |
parent | e215d5b574be75173d3a2e7082773f6d2853682c (diff) | |
download | RustAndDust-cbe4077b975abbceb508c41b33523e1aafac8594.zip RustAndDust-cbe4077b975abbceb508c41b33523e1aafac8594.tar.gz |
UnitDock: do net select on hit, add Unit select(float, float)
-rw-r--r-- | TODO | 1 | ||||
-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 |
3 files changed, 11 insertions, 9 deletions
@@ -1,5 +1,4 @@ BUGS: - - unitDock click issues TODO: - GameModeMenu 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() |