diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2014-10-03 11:43:24 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2014-10-03 11:43:24 +0200 |
commit | 7e789d4438fd4a78285bdda0e9e33fe6f9645454 (patch) | |
tree | 6ca08413018aa65efdcb3a415702eb1b94edcb6b /core | |
parent | 93228ad6e320029b2e2eaba468e7e77604a6bcdb (diff) | |
download | RustAndDust-7e789d4438fd4a78285bdda0e9e33fe6f9645454.zip RustAndDust-7e789d4438fd4a78285bdda0e9e33fe6f9645454.tar.gz |
Pawn: add AnimationSequence getMoveAnimation(Vector<Vector3> path)
Diffstat (limited to 'core')
-rw-r--r-- | core/src/ch/asynk/tankontank/engine/Pawn.java | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/Pawn.java b/core/src/ch/asynk/tankontank/engine/Pawn.java index 582fbfd..d49e83f 100644 --- a/core/src/ch/asynk/tankontank/engine/Pawn.java +++ b/core/src/ch/asynk/tankontank/engine/Pawn.java @@ -90,6 +90,27 @@ public abstract class Pawn extends Image implements Disposable return seq; } + public AnimationSequence getMoveAnimation(Vector<Vector3> path) + { + int s = path.size(); + final Vector3 finalPos = path.get(s - 1); + + AnimationSequence seq = AnimationSequence.get(s + 1); + + for (Vector3 v : path) { + seq.addAnimation(MoveToAnimation.get(this, v, MOVE_TIME)); + } + + seq.addAnimation(RunnableAnimation.get(this, new Runnable() { + @Override + public void run() { + moves.push(finalPos); + } + })); + + return seq; + } + public boolean hasOverlayEnabled() { return overlays.isEnabled(); |