Beispiel #1
0
        public void UpdateClip(PlayAnimatorClip playAnimClip, float clipTime, float clipPrevious, float weight)
        {
            if (animator == null)
            {
                return;
            }

#if UNITY_2017_1_OR_NEWER
            if (!graph.IsValid())
            {
                return;
            }
#elif UNITY_5_6_OR_NEWER
            if (!graph.IsValid())
            {
                return;
            }
#else
            if (!mixerPlayable.IsValid())
            {
                return;
            }
#endif

            var index = ports[playAnimClip];

#if UNITY_2017_1_OR_NEWER
            var clipPlayable = mixerPlayable.GetInput(index);
            clipPlayable.SetTime(clipTime);
            mixerPlayable.SetInputWeight(index, weight);
            mixerPlayable.SetInputWeight(0, activeClips == 2? 0 : 1 - weight);
#elif UNITY_5_6_OR_NEWER
            var clipPlayable = mixerPlayableHandle.GetInput(index);
            clipPlayable.time = clipTime;
            mixerPlayableHandle.SetInputWeight(index, weight);
            mixerPlayableHandle.SetInputWeight(0, activeClips == 2? 0 : 1 - weight);
#else
            var clipPlayable = mixerPlayable.GetInput(index);
            clipPlayable.time = clipTime;
            mixerPlayable.SetInput(clipPlayable, index);
            mixerPlayable.SetInputWeight(index, weight);
            mixerPlayable.SetInputWeight(0, activeClips == 2? 0 : 1 - weight);
#endif
        }
        public void UpdateClip(PlayAnimatorClip playAnimClip, float clipTime, float clipPrevious, float weight)
        {
            if (animator == null)
            {
                return;
            }

            if (!graph.IsValid())
            {
                return;
            }

            var index = ports[playAnimClip];

            var clipPlayable = mixerPlayableHandle.GetInput(index);

            clipPlayable.time = clipTime;
            mixerPlayableHandle.SetInputWeight(index, weight);
            mixerPlayableHandle.SetInputWeight(0, activeClips == 2? 0 : 1 - weight);
        }