Fixed last event being fired too many times.

This commit is contained in:
NathanSweet 2013-10-03 20:33:03 +02:00
parent 08d5efa31d
commit 981e7a1371
3 changed files with 6 additions and 0 deletions

View File

@ -518,6 +518,8 @@ void _EventTimeline_apply (const Timeline* timeline, Skeleton* skeleton, float l
EventTimeline* self = (EventTimeline*)timeline;
int frameIndex;
if (lastTime >= self->frames[self->framesLength - 1]) return; // Last time is after last frame.
if (lastTime > time) {
/* Fire events after last time for looped animations. */
_EventTimeline_apply(timeline, skeleton, lastTime, (float)INT_MAX, firedEvents, eventCount, alpha);

View File

@ -463,6 +463,8 @@ namespace Spine {
float[] frames = this.frames;
int frameCount = frames.Length;
if (lastTime >= frames[frameCount - 1]) return; // Last time is after last frame.
if (lastTime > time) { // Fire events after last time for looped animations.
Apply(skeleton, lastTime, int.MaxValue, firedEvents, alpha);
lastTime = 0;

View File

@ -537,6 +537,8 @@ public class Animation {
float[] frames = this.frames;
int frameCount = frames.length;
if (lastTime >= frames[frameCount - 1]) return; // Last time is after last frame.
if (lastTime > time) { // Fire events after last time for looped animations.
apply(skeleton, lastTime, Integer.MAX_VALUE, firedEvents, alpha);
lastTime = 0;