diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2014-09-20 22:44:46 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2014-09-20 22:44:46 +0200 |
commit | a5009e8a3d312a53d54c842fbcdba1487662228a (patch) | |
tree | 1d03aaa515c2358e509954644d3f0185ade031d3 /core/src/ch/asynk/tankontank/engine/gfx | |
parent | c1afb49e5ab9f94f637205564637cf5a6895f065 (diff) | |
download | RustAndDust-a5009e8a3d312a53d54c842fbcdba1487662228a.zip RustAndDust-a5009e8a3d312a53d54c842fbcdba1487662228a.tar.gz |
cleaup animations
Diffstat (limited to 'core/src/ch/asynk/tankontank/engine/gfx')
5 files changed, 28 insertions, 23 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/gfx/Animation.java b/core/src/ch/asynk/tankontank/engine/gfx/Animation.java index ca32857..5dd32d9 100644 --- a/core/src/ch/asynk/tankontank/engine/gfx/Animation.java +++ b/core/src/ch/asynk/tankontank/engine/gfx/Animation.java @@ -6,5 +6,5 @@ public interface Animation extends Disposable { public Node getNode(); - public boolean act(float delta); + public boolean animate(float delta); } diff --git a/core/src/ch/asynk/tankontank/engine/gfx/animations/AnimationSequence.java b/core/src/ch/asynk/tankontank/engine/gfx/animations/AnimationSequence.java index a933ec1..4c6a5f9 100644 --- a/core/src/ch/asynk/tankontank/engine/gfx/animations/AnimationSequence.java +++ b/core/src/ch/asynk/tankontank/engine/gfx/animations/AnimationSequence.java @@ -54,12 +54,13 @@ public class AnimationSequence implements Animation, Pool.Poolable animations.add(animation); } - public boolean act(float delta) + @Override + public boolean animate(float delta) { if(animations.isEmpty()) return true; Animation animation = animations.get(0); - if (animation.act(delta)) { + if (animation.animate(delta)) { animations.removeElementAt(0); } diff --git a/core/src/ch/asynk/tankontank/engine/gfx/animations/MoveToAnimation.java b/core/src/ch/asynk/tankontank/engine/gfx/animations/MoveToAnimation.java index 54c3033..8b42771 100644 --- a/core/src/ch/asynk/tankontank/engine/gfx/animations/MoveToAnimation.java +++ b/core/src/ch/asynk/tankontank/engine/gfx/animations/MoveToAnimation.java @@ -22,18 +22,6 @@ public class MoveToAnimation extends TimedAnimation } }; - @Override - public Node getNode() - { - return node; - } - - @Override - public void dispose() - { - moveToAnimationPool.free(this); - } - public static MoveToAnimation get(Node node, Vector3 v, float duration) { return get(node, v.x, v.y, v.z, duration); @@ -52,6 +40,19 @@ public class MoveToAnimation extends TimedAnimation return a; } + @Override + public Node getNode() + { + return node; + } + + @Override + public void dispose() + { + moveToAnimationPool.free(this); + } + + @Override protected void begin() { fromX = node.getX(); @@ -59,11 +60,13 @@ public class MoveToAnimation extends TimedAnimation fromR = node.getRotation(); } + @Override protected void end() { dispose(); } + @Override protected void update(float percent) { if (percent == 1f) diff --git a/core/src/ch/asynk/tankontank/engine/gfx/animations/RunnableAnimation.java b/core/src/ch/asynk/tankontank/engine/gfx/animations/RunnableAnimation.java index bc6768c..37d6d9d 100644 --- a/core/src/ch/asynk/tankontank/engine/gfx/animations/RunnableAnimation.java +++ b/core/src/ch/asynk/tankontank/engine/gfx/animations/RunnableAnimation.java @@ -43,7 +43,7 @@ public class RunnableAnimation implements Animation, Pool.Poolable } @Override - public boolean act(float delta) + public boolean animate(float delta) { if (ran) return true; diff --git a/core/src/ch/asynk/tankontank/engine/gfx/animations/TimedAnimation.java b/core/src/ch/asynk/tankontank/engine/gfx/animations/TimedAnimation.java index c7854d0..96eed32 100644 --- a/core/src/ch/asynk/tankontank/engine/gfx/animations/TimedAnimation.java +++ b/core/src/ch/asynk/tankontank/engine/gfx/animations/TimedAnimation.java @@ -1,16 +1,20 @@ package ch.asynk.tankontank.engine.gfx.animations; -import com.badlogic.gdx.utils.Pool.Poolable; +import com.badlogic.gdx.utils.Pool; import ch.asynk.tankontank.engine.gfx.Animation; -abstract public class TimedAnimation implements Animation, Poolable +public abstract class TimedAnimation implements Animation, Pool.Poolable { private float time; private boolean began; private boolean completed; protected float duration; + abstract protected void begin(); + abstract protected void end(); + abstract protected void update(float percent); + @Override public void reset() { @@ -19,11 +23,8 @@ abstract public class TimedAnimation implements Animation, Poolable completed = false; } - abstract protected void begin(); - abstract protected void end(); - abstract protected void update(float percent); - - public boolean act(float delta) + @Override + public boolean animate(float delta) { if (completed) return true; |