Exemplo n.º 1
0
        public static PlayableGestureRTC CreateAfter(
            RuntimeAnimatorController rtc, AvatarMask avatarMask,
            float fadeIn, float fadeOut, float speed,
            ref PlayableGraph graph, PlayableBase previous,
            params Parameter[] parameters)
        {
            PlayableGestureRTC gesture = new PlayableGestureRTC(
                rtc, avatarMask,
                fadeIn, fadeOut, speed
                );

            AnimatorControllerPlayable input1 = AnimatorControllerPlayable.Create(graph, rtc);

            foreach (Parameter parameter in parameters)
            {
                input1.SetFloat(parameter.id, parameter.value);
            }

            float duration = 0f;

            foreach (AnimationClip clip in rtc.animationClips)
            {
                duration = Mathf.Max(duration, clip.length);
            }

            input1.SetTime(0f);
            input1.SetSpeed(speed);
            input1.SetDuration(duration);

            gesture.Setup(ref graph, previous, ref input1);
            return(gesture);
        }
Exemplo n.º 2
0
        public void CrossFadeGesture(RuntimeAnimatorController rtc, AvatarMask avatarMask,
                                     float fadeIn, float fadeOut, float speed,
                                     params PlayableGesture.Parameter[] parameters)
        {
            if (this.gestures.Count == 0)
            {
                this.gestures.Add(PlayableGestureRTC.Create(
                                      rtc, avatarMask,
                                      fadeIn, fadeOut, speed,
                                      ref this.graph,
                                      ref this.mixerGesturesInput,
                                      ref this.mixerGesturesOutput,
                                      parameters
                                      ));
            }
            else
            {
                PlayableGesture previous = gestures[this.gestures.Count - 1];
                previous.StretchDuration(fadeIn);

                this.gestures.Add(PlayableGestureRTC.CreateAfter(
                                      rtc, avatarMask,
                                      fadeIn, fadeOut, speed,
                                      ref this.graph,
                                      previous,
                                      parameters
                                      ));
            }
        }
Exemplo n.º 3
0
        public static PlayableGestureRTC Create <TInput0, TOutput>(
            RuntimeAnimatorController rtc, AvatarMask avatarMask,
            float fadeIn, float fadeOut, float speed,
            ref PlayableGraph graph, ref TInput0 input0, ref TOutput output,
            params Parameter[] parameters)
            where TInput0 : struct, IPlayable
            where TOutput : struct, IPlayable
        {
            PlayableGestureRTC gesture = new PlayableGestureRTC(
                rtc, avatarMask,
                fadeIn, fadeOut, speed
                );

            AnimatorControllerPlayable input1 = AnimatorControllerPlayable.Create(graph, rtc);

            foreach (Parameter parameter in parameters)
            {
                input1.SetFloat(parameter.id, parameter.value);
            }

            float duration = 0f;

            foreach (AnimationClip clip in rtc.animationClips)
            {
                duration = Mathf.Max(duration, clip.length);
            }

            input1.SetTime(0f);
            input1.SetSpeed(speed);
            input1.SetDuration(duration);

            gesture.Setup(ref graph, ref input0, ref input1, ref output);
            return(gesture);
        }