summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2018-10-13 21:30:33 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2018-10-13 21:30:33 +0200
commitc34e49dbf0155ad89579d8df45a717aeef8adb2e (patch)
tree97b96a59f6b93f2d3a26b8b824b3cfa776dd5fd2 /core
parente612a7e78883c91b008d97585f1e4f73d773d490 (diff)
downloadgdx-boardgame-c34e49dbf0155ad89579d8df45a717aeef8adb2e.zip
gdx-boardgame-c34e49dbf0155ad89579d8df45a717aeef8adb2e.tar.gz
AnimationSequence : small improvements
Diffstat (limited to 'core')
-rw-r--r--core/src/ch/asynk/gdx/boardgame/animations/AnimationSequence.java22
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)