diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2014-09-21 02:53:08 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2014-09-21 02:53:08 +0200 |
commit | a7662a4a96ae321a2c741bac6534f1356729c5be (patch) | |
tree | e8234362ef03ed48cb91a31a4b7c8944aa0b341d /core/src/ch | |
parent | 0eadb568da51b16194596786650080d339ef626c (diff) | |
download | RustAndDust-a7662a4a96ae321a2c741bac6534f1356729c5be.zip RustAndDust-a7662a4a96ae321a2c741bac6534f1356729c5be.tar.gz |
RunnableAnimation needs a ref to Pawn too
Diffstat (limited to 'core/src/ch')
-rw-r--r-- | core/src/ch/asynk/tankontank/engine/PawnImage.java | 2 | ||||
-rw-r--r-- | core/src/ch/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<RunnableAnimation> runnableAnimationPool = new Pool<RunnableAnimation>() { @@ -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 |