From a7662a4a96ae321a2c741bac6534f1356729c5be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Sun, 21 Sep 2014 02:53:08 +0200 Subject: RunnableAnimation needs a ref to Pawn too --- core/src/ch/asynk/tankontank/engine/PawnImage.java | 2 +- .../asynk/tankontank/engine/gfx/animations/RunnableAnimation.java | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/core/src/ch/asynk/tankontank/engine/PawnImage.java b/core/src/ch/asynk/tankontank/engine/PawnImage.java index ac4a071..4a16cd5 100644 --- a/core/src/ch/asynk/tankontank/engine/PawnImage.java +++ b/core/src/ch/asynk/tankontank/engine/PawnImage.java @@ -58,7 +58,7 @@ public class PawnImage extends Image implements Pawn seq.addAnimation(MoveToAnimation.get(this, path.pop(), MOVE_TIME)); } - seq.addAnimation(RunnableAnimation.get(new Runnable() { + seq.addAnimation(RunnableAnimation.get(this, new Runnable() { @Override public void run() { path.push(finalPos); 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 41a08a7..24b1e4b 100644 --- a/core/src/ch/asynk/tankontank/engine/gfx/animations/RunnableAnimation.java +++ b/core/src/ch/asynk/tankontank/engine/gfx/animations/RunnableAnimation.java @@ -8,6 +8,7 @@ import ch.asynk.tankontank.engine.gfx.Animation; public class RunnableAnimation implements Animation, Pool.Poolable { private Runnable runnable; + private Pawn pawn; private boolean ran; private static final Pool runnableAnimationPool = new Pool() { @@ -17,10 +18,11 @@ public class RunnableAnimation implements Animation, Pool.Poolable } }; - public static RunnableAnimation get(Runnable runnable) + public static RunnableAnimation get(Pawn pawn, Runnable runnable) { RunnableAnimation a = runnableAnimationPool.obtain(); a.runnable = runnable; + a.pawn = pawn; return a; } @@ -39,7 +41,7 @@ public class RunnableAnimation implements Animation, Pool.Poolable @Override public Pawn getPawn() { - return null; + return pawn; } @Override -- cgit v1.1-2-g2b99