Пример #1
0
        public void Update(AnimationDataObject _data)
        {
            if (_data == null || _data.Enabled == false || _data.InterfaceType == AnimationInterfaceType.NONE)
            {
                return;
            }

            if (_data.InterfaceType == AnimationInterfaceType.MECANIM)
            {
                if (_data.Animator.Type == AnimatorControlType.ADVANCED)
                {
                    UpdateAnimatorParameter(_data.Animator, false);
                }
                else if (_data.Animator.Type == AnimatorControlType.DIRECT)
                {
                    UpdateAnimatorState(_data.Animator);
                }
            }
            else if (_data.InterfaceType == AnimationInterfaceType.CUSTOM)
            {
                if (OnCustomAnimationUpdate != null)
                {
                    OnCustomAnimationUpdate();
                }
            }
        }
Пример #2
0
        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();
                }
            }
        }
Пример #3
0
        public void Copy(AnimationDataObject _data)
        {
            base.Copy(_data);

            AllowInterfaceSelector = _data.AllowInterfaceSelector;
            InterfaceType          = _data.InterfaceType;

            Animator.Copy(_data.Animator);
            Animation.Copy(_data.Animation);
            Clip.Copy(_data.Clip);
            Events.Copy(_data.Events);
        }
Пример #4
0
 public AnimationDataObject(AnimationDataObject _data) : base(_data)
 {
     Copy(_data);
 }