diff options
5 files changed, 30 insertions, 14 deletions
diff --git a/core/src/ch/asynk/tankontank/game/Hud.java b/core/src/ch/asynk/tankontank/game/Hud.java index fd63d03..10af85b 100644 --- a/core/src/ch/asynk/tankontank/game/Hud.java +++ b/core/src/ch/asynk/tankontank/game/Hud.java @@ -9,6 +9,7 @@ import com.badlogic.gdx.graphics.g2d.TextureAtlas; import com.badlogic.gdx.graphics.g2d.BitmapFont; import com.badlogic.gdx.graphics.glutils.ShapeRenderer; +import ch.asynk.tankontank.engine.gfx.Animation; import ch.asynk.tankontank.game.State.StateType; import ch.asynk.tankontank.game.hud.Position; import ch.asynk.tankontank.game.hud.Msg; @@ -21,7 +22,7 @@ import ch.asynk.tankontank.game.hud.Widget; import ch.asynk.tankontank.TankOnTank; -public class Hud implements Disposable +public class Hud implements Disposable, Animation { public static final float OFFSET = 10f; public static final float NOTIFY_DURATION = 2f; @@ -77,11 +78,13 @@ public class Hud implements Disposable actionButtons.setPosition(position.horizontalMirror()); } - public void animate(float delta) + @Override + public boolean animate(float delta) { msg.animate(delta); playerInfo.animate(delta); engagement.animate(delta); + return false; } public void draw(Batch batch) diff --git a/core/src/ch/asynk/tankontank/game/hud/Engagement.java b/core/src/ch/asynk/tankontank/game/hud/Engagement.java index b21011e..a5d10cf 100644 --- a/core/src/ch/asynk/tankontank/game/hud/Engagement.java +++ b/core/src/ch/asynk/tankontank/game/hud/Engagement.java @@ -9,9 +9,10 @@ import com.badlogic.gdx.graphics.glutils.ShapeRenderer; import ch.asynk.tankontank.game.Map; import ch.asynk.tankontank.game.Army; +import ch.asynk.tankontank.engine.gfx.Animation; import ch.asynk.tankontank.engine.gfx.animations.DiceAnimation; -public class Engagement extends Bg +public class Engagement extends Bg implements Animation { public static int FLAG_HEIGHT = 24; public float padding; @@ -106,11 +107,13 @@ public class Engagement extends Bg return false; } - public void animate(float delta) + @Override + public boolean animate(float delta) { - if (!visible) return; + if (!visible) return true; d1Animation.animate(delta); d2Animation.animate(delta); + return false; } @Override diff --git a/core/src/ch/asynk/tankontank/game/hud/Msg.java b/core/src/ch/asynk/tankontank/game/hud/Msg.java index 5675016..cc701fb 100644 --- a/core/src/ch/asynk/tankontank/game/hud/Msg.java +++ b/core/src/ch/asynk/tankontank/game/hud/Msg.java @@ -7,7 +7,9 @@ import com.badlogic.gdx.graphics.g2d.BitmapFont; import com.badlogic.gdx.graphics.g2d.TextureRegion; import com.badlogic.gdx.graphics.glutils.ShapeRenderer; -public class Msg extends Label +import ch.asynk.tankontank.engine.gfx.Animation; + +public class Msg extends Label implements Animation { class MsgInfo { @@ -69,9 +71,10 @@ public class Msg extends Label bg.set(rect); } - public void animate(float delta) + @Override + public boolean animate(float delta) { - if (!visible) return; + if (!visible) return true; elapsed += delta; if (elapsed >= duration) { visible = false; @@ -80,6 +83,7 @@ public class Msg extends Label write(info.text, info.duration, info.position); } } + return false; } @Override diff --git a/core/src/ch/asynk/tankontank/game/hud/PlayerInfo.java b/core/src/ch/asynk/tankontank/game/hud/PlayerInfo.java index 3c25b2c..0cde301 100644 --- a/core/src/ch/asynk/tankontank/game/hud/PlayerInfo.java +++ b/core/src/ch/asynk/tankontank/game/hud/PlayerInfo.java @@ -8,6 +8,7 @@ import com.badlogic.gdx.graphics.g2d.TextureAtlas; import com.badlogic.gdx.graphics.g2d.BitmapFont; import com.badlogic.gdx.graphics.glutils.ShapeRenderer; +import ch.asynk.tankontank.engine.gfx.Animation; import ch.asynk.tankontank.engine.gfx.Drawable; import ch.asynk.tankontank.game.State.StateType; @@ -17,7 +18,7 @@ import ch.asynk.tankontank.game.Army; import ch.asynk.tankontank.game.Unit; import ch.asynk.tankontank.game.Player; -public class PlayerInfo implements Disposable, Drawable +public class PlayerInfo implements Disposable, Drawable, Animation { private final Ctrl ctrl; @@ -150,9 +151,11 @@ public class PlayerInfo implements Disposable, Drawable return true; } - public void animate(float delta) + @Override + public boolean animate(float delta) { unitDock.animate(delta); + return false; } @Override diff --git a/core/src/ch/asynk/tankontank/game/hud/UnitDock.java b/core/src/ch/asynk/tankontank/game/hud/UnitDock.java index ad9df87..de69004 100644 --- a/core/src/ch/asynk/tankontank/game/hud/UnitDock.java +++ b/core/src/ch/asynk/tankontank/game/hud/UnitDock.java @@ -8,12 +8,13 @@ import com.badlogic.gdx.math.Vector3; import com.badlogic.gdx.math.Matrix4; import com.badlogic.gdx.math.Rectangle; +import ch.asynk.tankontank.engine.gfx.Animation; import ch.asynk.tankontank.engine.Orientation; import ch.asynk.tankontank.game.Ctrl; import ch.asynk.tankontank.game.Unit; import ch.asynk.tankontank.game.UnitList; -public class UnitDock extends Bg +public class UnitDock extends Bg implements Animation { private static final float SCALE = 0.4f; private static final float STEP = 5f; @@ -128,10 +129,11 @@ public class UnitDock extends Bg dx = 0f; } - public void animate(float delta) + @Override + public boolean animate(float delta) { - if (!visible) return; - if (mvtDone) return; + if (!visible) return true; + if (mvtDone) return true; float x = (rect.x + dx); if (show) { @@ -159,6 +161,7 @@ public class UnitDock extends Bg point.set((rect.x + rect.width), (rect.y + rect.height), 0).mul(transform); scaledRect.width = point.x - scaledRect.x; scaledRect.height = point.y - scaledRect.y; + return false; } @Override |