From 7e789d4438fd4a78285bdda0e9e33fe6f9645454 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Fri, 3 Oct 2014 11:43:24 +0200 Subject: Pawn: add AnimationSequence getMoveAnimation(Vector path) --- core/src/ch/asynk/tankontank/engine/Pawn.java | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) 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 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(); -- cgit v1.1-2-g2b99