2D Toolkit Forum

2D Toolkit => Support => Topic started by: bmyu1 on March 23, 2017, 09:33:56 am

Title: tk2dSpriteAnimator.PlayFrom and AnimationCompleted Event
Post by: bmyu1 on March 23, 2017, 09:33:56 am
tk2dSpriteAnimator.PlayFrom(larger time than animation time) should fire AnimationCompleted Event immediately, but the event never happen.


tk2dSpriteAnimator.cs
               // clipStartTime is in seconds
               // clipTime is in clip local time (ignoring fps)
               float time = clipStartTime * clipFps;
               if (currentClip.wrapMode == tk2dSpriteAnimationClip.WrapMode.Once && time >= clipFps * currentClip.frames.Length)
               {
                  // warp to last frame
                  WarpClipToLocalTime(currentClip, currentClip.frames.Length - 1);
                        OnAnimationCompleted(); <<<< This line should be added.
                        state &= ~State.Playing;
               }
Title: Re: tk2dSpriteAnimator.PlayFrom and AnimationCompleted Event
Post by: unikronsoftware on March 26, 2017, 11:11:13 pm
Good catch. Thanks, will fix this.