void TickAnimate(float delta) { if (Animate) { var controller = GetAnimationController(); if (controller != null) { //update event animation if (eventAnimation != null) { eventAnimationUpdateMethod?.Invoke(); } if (eventAnimation != null) { var current = controller.PlayAnimation.Value; if (current == eventAnimation && controller.CurrentAnimationTime == eventAnimation.Length) { EventAnimationEnd(); } } //update controller Component_Animation animation = null; bool autoRewind = true; double speed = 1; //event animation if (eventAnimation != null) { animation = eventAnimation; autoRewind = false; } //current state animation if (animation == null && EngineApp.ApplicationType == EngineApp.ApplicationTypeEnum.Simulation) { //animation = FlyAnimation; //autoRewind = true; } if (animation == null) { animation = IdleAnimation; autoRewind = true; } //update controller controller.PlayAnimation = animation; controller.AutoRewind = autoRewind; controller.Speed = speed; } } }
public void EventAnimationEnd() { eventAnimation = null; eventAnimationUpdateMethod = null; }
public void EventAnimationBegin(Component_Animation animation, Action updateMethod = null) { eventAnimation = animation; eventAnimationUpdateMethod = updateMethod; }