diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2018-10-13 21:30:33 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2018-10-13 21:30:33 +0200 |
commit | c34e49dbf0155ad89579d8df45a717aeef8adb2e (patch) | |
tree | 97b96a59f6b93f2d3a26b8b824b3cfa776dd5fd2 /core/src/ch/asynk/gdx/boardgame/animations | |
parent | e612a7e78883c91b008d97585f1e4f73d773d490 (diff) | |
download | gdx-boardgame-c34e49dbf0155ad89579d8df45a717aeef8adb2e.zip gdx-boardgame-c34e49dbf0155ad89579d8df45a717aeef8adb2e.tar.gz |
AnimationSequence : small improvements
Diffstat (limited to 'core/src/ch/asynk/gdx/boardgame/animations')
-rw-r--r-- | core/src/ch/asynk/gdx/boardgame/animations/AnimationSequence.java | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/core/src/ch/asynk/gdx/boardgame/animations/AnimationSequence.java b/core/src/ch/asynk/gdx/boardgame/animations/AnimationSequence.java index 4732c53..88bb15b 100644 --- a/core/src/ch/asynk/gdx/boardgame/animations/AnimationSequence.java +++ b/core/src/ch/asynk/gdx/boardgame/animations/AnimationSequence.java @@ -47,32 +47,34 @@ public class AnimationSequence implements Animation, Pool.Poolable animationSequencePool.free(this); } - public void addAnimation(Animation animation) + public void add(Animation animation) { animations.add(animation); } @Override public boolean completed() { - return (animations.size() == 0); + return animations.isEmpty(); } @Override public boolean animate(float delta) { - if (animations.isEmpty()) return true; - - Animation animation = animations.get(0); - if (animation.animate(delta)) { - animations.remove(0); - animation.dispose(); + if (!completed()) { + Animation animation = animations.get(0); + if (animation.animate(delta)) { + animations.remove(0); + animation.dispose(); + } } - return (animations.isEmpty()); + return completed(); } @Override public void draw(Batch batch) { - animations.get(0).draw(batch); + if (!completed()) { + animations.get(0).draw(batch); + } } @Override public void drawDebug(ShapeRenderer debugShapes) |