diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2014-09-21 02:10:08 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2014-09-21 02:10:08 +0200 |
commit | 0eadb568da51b16194596786650080d339ef626c (patch) | |
tree | 199c873504b28e8142617a1d3432b759e3fc881a /core | |
parent | f42de5230fedee63bc0783f26822790bbba82dfe (diff) | |
download | RustAndDust-0eadb568da51b16194596786650080d339ef626c.zip RustAndDust-0eadb568da51b16194596786650080d339ef626c.tar.gz |
animations do not handle Node anymore but Pawn
Diffstat (limited to 'core')
4 files changed, 21 insertions, 19 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/gfx/Animation.java b/core/src/ch/asynk/tankontank/engine/gfx/Animation.java index 5dd32d9..742810c 100644 --- a/core/src/ch/asynk/tankontank/engine/gfx/Animation.java +++ b/core/src/ch/asynk/tankontank/engine/gfx/Animation.java @@ -2,9 +2,11 @@ package ch.asynk.tankontank.engine.gfx; import com.badlogic.gdx.utils.Disposable; +import ch.asynk.tankontank.engine.Pawn; + public interface Animation extends Disposable { - public Node getNode(); + public Pawn getPawn(); 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 4c6a5f9..79cf021 100644 --- a/core/src/ch/asynk/tankontank/engine/gfx/animations/AnimationSequence.java +++ b/core/src/ch/asynk/tankontank/engine/gfx/animations/AnimationSequence.java @@ -4,7 +4,7 @@ import java.util.Vector; import com.badlogic.gdx.utils.Pool; -import ch.asynk.tankontank.engine.gfx.Node; +import ch.asynk.tankontank.engine.Pawn; import ch.asynk.tankontank.engine.gfx.Animation; public class AnimationSequence implements Animation, Pool.Poolable @@ -44,9 +44,9 @@ public class AnimationSequence implements Animation, Pool.Poolable } @Override - public Node getNode() + public Pawn getPawn() { - return animations.get(0).getNode(); + return animations.get(0).getPawn(); } public void addAnimation(Animation animation) 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 8b42771..9a48db4 100644 --- a/core/src/ch/asynk/tankontank/engine/gfx/animations/MoveToAnimation.java +++ b/core/src/ch/asynk/tankontank/engine/gfx/animations/MoveToAnimation.java @@ -3,11 +3,11 @@ package ch.asynk.tankontank.engine.gfx.animations; import com.badlogic.gdx.math.Vector3; import com.badlogic.gdx.utils.Pool; -import ch.asynk.tankontank.engine.gfx.Node; +import ch.asynk.tankontank.engine.Pawn; public class MoveToAnimation extends TimedAnimation { - private Node node; + private Pawn pawn; private float fromX; private float fromY; private float fromR; @@ -22,16 +22,16 @@ public class MoveToAnimation extends TimedAnimation } }; - public static MoveToAnimation get(Node node, Vector3 v, float duration) + public static MoveToAnimation get(Pawn pawn, Vector3 v, float duration) { - return get(node, v.x, v.y, v.z, duration); + return get(pawn, v.x, v.y, v.z, duration); } - public static MoveToAnimation get(Node node, float x, float y, float r, float duration) + public static MoveToAnimation get(Pawn pawn, float x, float y, float r, float duration) { MoveToAnimation a = moveToAnimationPool.obtain(); - a.node = node; + a.pawn = pawn; a.toX = x; a.toY = y; a.toR = r; @@ -41,9 +41,9 @@ public class MoveToAnimation extends TimedAnimation } @Override - public Node getNode() + public Pawn getPawn() { - return node; + return pawn; } @Override @@ -55,9 +55,9 @@ public class MoveToAnimation extends TimedAnimation @Override protected void begin() { - fromX = node.getX(); - fromY = node.getY(); - fromR = node.getRotation(); + fromX = pawn.getX(); + fromY = pawn.getY(); + fromR = pawn.getRotation(); } @Override @@ -70,8 +70,8 @@ public class MoveToAnimation extends TimedAnimation protected void update(float percent) { if (percent == 1f) - node.setPosition(toX, toY, (int) toR); + pawn.setPosition(toX, toY, (int) toR); else - node.setPosition(fromX + ((toX - fromX) * percent), fromY + ((toY - fromY) * percent), (int) (fromR + ((toR - fromR) * percent))); + pawn.setPosition(fromX + ((toX - fromX) * percent), fromY + ((toY - fromY) * percent), (int) (fromR + ((toR - fromR) * percent))); } } 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 37d6d9d..41a08a7 100644 --- a/core/src/ch/asynk/tankontank/engine/gfx/animations/RunnableAnimation.java +++ b/core/src/ch/asynk/tankontank/engine/gfx/animations/RunnableAnimation.java @@ -2,7 +2,7 @@ package ch.asynk.tankontank.engine.gfx.animations; import com.badlogic.gdx.utils.Pool; -import ch.asynk.tankontank.engine.gfx.Node; +import ch.asynk.tankontank.engine.Pawn; import ch.asynk.tankontank.engine.gfx.Animation; public class RunnableAnimation implements Animation, Pool.Poolable @@ -37,7 +37,7 @@ public class RunnableAnimation implements Animation, Pool.Poolable } @Override - public Node getNode() + public Pawn getPawn() { return null; } |