From c7bb3f3af875608bf3d02c80dd1d852f5fde95c9 Mon Sep 17 00:00:00 2001 From: NathanSweet Date: Tue, 12 Jan 2016 17:18:45 +0100 Subject: [PATCH] Ensure the track entry has the correct time when start and end are fired. #154 --- .../src/com/esotericsoftware/spine/AnimationState.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/AnimationState.java b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/AnimationState.java index dc1f43f10..eda2a2426 100644 --- a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/AnimationState.java +++ b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/AnimationState.java @@ -68,8 +68,11 @@ public class AnimationState { if (next != null) { float nextTime = current.lastTime - next.delay; if (nextTime >= 0) { - next.time = nextTime; + float nextDelta = delta * next.timeScale; + next.time = nextTime + nextDelta; // For start event to see correct time. + current.time += delta * current.timeScale; // For end event to see correct time. setCurrent(i, next); + next.time -= nextDelta; // Prevent increasing time twice, below. current = next; } } else if (!current.loop && current.lastTime >= current.endTime) {