diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2015-12-10 09:01:25 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2015-12-10 09:01:25 +0100 |
commit | 48959904e8d063e055971d33b2c205236ebbd3e0 (patch) | |
tree | d3d39ac02c3b11172530f06558e7811e10318134 /core/src/ch/asynk | |
parent | 74a1f5fb0817a19c37ea16e2c51c06265338ab70 (diff) | |
download | RustAndDust-48959904e8d063e055971d33b2c205236ebbd3e0.zip RustAndDust-48959904e8d063e055971d33b2c205236ebbd3e0.tar.gz |
Hud: add delay before closing engagement dialog after animations done
Diffstat (limited to 'core/src/ch/asynk')
-rw-r--r-- | core/src/ch/asynk/rustanddust/game/Hud.java | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/core/src/ch/asynk/rustanddust/game/Hud.java b/core/src/ch/asynk/rustanddust/game/Hud.java index 033baaf..522837e 100644 --- a/core/src/ch/asynk/rustanddust/game/Hud.java +++ b/core/src/ch/asynk/rustanddust/game/Hud.java @@ -28,6 +28,7 @@ public class Hud implements Disposable, Animation { public static final float OFFSET = 10f; public static final float NOTIFY_DURATION = 2f; + private static final float CLOSE_DELAY = 0.8f; private final RustAndDust game; private final Ctrl ctrl; @@ -37,6 +38,8 @@ public class Hud implements Disposable, Animation public PlayerInfo playerInfo; public ActionButtons actionButtons; + private float delay; + private boolean delayOn; private Msg msg; private StatisticsPanel stats; private EngagementPanel engagement; @@ -56,6 +59,7 @@ public class Hud implements Disposable, Animation { this.game = game; this.ctrl = game.ctrl; + this.delayOn = false; TextureAtlas hudAtlas = game.factory.hudAtlas; playerInfo = new PlayerInfo(ctrl, game.font, game.uiAtlas, hudAtlas); @@ -99,6 +103,12 @@ public class Hud implements Disposable, Animation @Override public boolean animate(float delta) { + if (delayOn) { + delay -= delta; + if (delay < 0f) { + delayOver(); + } + } msg.animate(delta); playerInfo.animate(delta); engagement.animate(delta); @@ -248,6 +258,13 @@ public class Hud implements Disposable, Animation public void notifyAnimationsEnd() { + delay = CLOSE_DELAY; + delayOn = true; + } + + private void delayOver() + { + delayOn = false; Widget dialog = dialogs.getFirst(); if (dialog == engagement) closeDialog(); |