public override void Prepare() { if (members.Count < 1) { throw new System.Exception("Memebers cannot be empty"); } foreach (var member in members) { if (!AnimationComponent.GetClip(member.Clip.name)) { AnimationComponent.AddClip(member.Clip, member.Clip.name); } } playForList.Clear(); var previousPlayfor = 0f; for (var i = 0; i < members.Count - 1; i++) { previousPlayfor += members[i].PlayFor; playForList.Add(previousPlayfor); } timeElapsedDuringDelay = 0f; timeElapsedInSec = 0f; currentPlayingIndex = 0; isPlayed = false; AnimationComponent.Stop(); }
public override void Prepare() { base.Prepare(); if (!AnimationComponent.GetClip(Clip.name)) { AnimationComponent.AddClip(Clip, Clip.name); } }
public void Play(AnimationDataObject _data) { if (_data == null || _data.Enabled == false || _data.InterfaceType == AnimationInterfaceType.NONE) { return; } if (_data.InterfaceType == AnimationInterfaceType.LEGACY) { if (AnimationComponent == null) { PrintErrorLog(this, "Missing Animation Component!"); return; } AnimationComponent[_data.Animation.Name].wrapMode = _data.Animation.wrapMode; AnimationComponent[_data.Animation.Name].speed = _data.Animation.Speed; //Mathf.Clamp( m_BehaviourData.MoveVelocity. controller.velocity.magnitude, 0.0, runMaxAnimationSpeed); AnimationComponent.CrossFade(_data.Animation.Name, _data.Animation.TransitionDuration); } else if (_data.InterfaceType == AnimationInterfaceType.CLIP) { if (AnimationComponent != null && _data.Clip.Clip != null) { AnimationComponent.AddClip(_data.Clip.Clip, _data.Clip.Clip.name); AnimationComponent.CrossFade(_data.Clip.Clip.name, _data.Clip.TransitionDuration); } } else if (_data.InterfaceType == AnimationInterfaceType.MECANIM) { if (AnimatorComponent == null || AnimatorComponent.runtimeAnimatorController == null || !AnimatorComponent.isInitialized) { return; } if (AnimatorComponent.applyRootMotion != _data.Animator.ApplyRootMotion) { AnimatorComponent.applyRootMotion = _data.Animator.ApplyRootMotion; } if (_data.Animator.Type == AnimatorControlType.DIRECT) { UpdateAnimatorState(_data.Animator); } else if (_data.Animator.Type == AnimatorControlType.ADVANCED) { UpdateAnimatorParameter(_data.Animator, false); } } else if (_data.InterfaceType == AnimationInterfaceType.CUSTOM) { if (OnCustomAnimation != null) { OnCustomAnimation(); } } }