public void StartAnimation(IAnimation animation) { if (_scale.Width == 0f && animation.Frames.Count > 0) { _scale.ResetBaseSize(animation.Frames [0].Sprite.Width, animation.Frames [0].Sprite.Height); } IAnimation currentAnimation = Animation; if (currentAnimation != null) { currentAnimation.State.OnAnimationCompleted.TrySetResult(new AnimationCompletedEventArgs(false)); } Animation = animation; OnAnimationStarted.Invoke(this, new AGSEventArgs()); }
public void StartAnimation(IAnimation animation) { var scale = _scale; if (scale?.Width == 0f && animation.Frames.Count > 0) { scale.BaseSize = new SizeF(animation.Frames[0].Sprite.Width, animation.Frames[0].Sprite.Height); } IAnimation currentAnimation = Animation; currentAnimation?.State.OnAnimationCompleted.TrySetResult(new AnimationCompletedEventArgs(false)); Animation = animation; OnAnimationStarted.Invoke(); }
public void Run() { AnimationStepTimer = new Timer { Interval = Delay }; AnimationStepTimer.Tick += (sender, args) => { if (Runtime.StopAnimation) { Stop(); return; } OnAnimationTick?.Invoke(this); }; AnimationStepTimer.Start(); OnAnimationStarted?.Invoke(this); }
public void IgniteOnAnimationStarted() { OnAnimationStarted?.Invoke(); }