From 7eb60cf7f72d34e95ff7388713121050366a774e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Wed, 9 Dec 2015 21:56:05 +0100 Subject: Ctrl: an isInAnimation param to hid.touchDown(...) --- core/src/ch/asynk/rustanddust/game/Ctrl.java | 14 +++----------- core/src/ch/asynk/rustanddust/game/Hud.java | 4 ++-- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/core/src/ch/asynk/rustanddust/game/Ctrl.java b/core/src/ch/asynk/rustanddust/game/Ctrl.java index 4179ccd..0d414bc 100644 --- a/core/src/ch/asynk/rustanddust/game/Ctrl.java +++ b/core/src/ch/asynk/rustanddust/game/Ctrl.java @@ -221,7 +221,9 @@ public class Ctrl implements Disposable public void touchDown() { - if (!blockHud && hud.touchDown(hudTouch.x, hudTouch.y)) + boolean inAnimation = (this.stateType == StateType.ANIMATION); + + if (!blockHud && hud.touchDown(hudTouch.x, hudTouch.y, inAnimation)) return; if (!blockMap && state.downInMap(mapTouch.x, mapTouch.y)) @@ -244,16 +246,6 @@ public class Ctrl implements Disposable state.touchUp(); } - public boolean isInAction() - { - return (state != selectState); - } - - public boolean isInAnimation() - { - return (this.stateType == StateType.ANIMATION); - } - public void setAfterAnimationState(StateType after) { stateAfterAnimation = after; diff --git a/core/src/ch/asynk/rustanddust/game/Hud.java b/core/src/ch/asynk/rustanddust/game/Hud.java index 68b2eb5..033baaf 100644 --- a/core/src/ch/asynk/rustanddust/game/Hud.java +++ b/core/src/ch/asynk/rustanddust/game/Hud.java @@ -155,7 +155,7 @@ public class Hud implements Disposable, Animation return playerInfo.drag(x, y, dx, dy); } - public boolean touchDown(float x, float y) + public boolean touchDown(float x, float y, boolean isInAnimation) { hit = null; @@ -168,7 +168,7 @@ public class Hud implements Disposable, Animation return false; } - if (ctrl.isInAnimation()) + if (isInAnimation) return false; if (hit == null) { -- cgit v1.1-2-g2b99