示例#1
0
        // STATIC CONSTRUCTORS: -------------------------------------------------------------------

        public static PlayableStateRTC Create <TInput0, TOutput>(
            RuntimeAnimatorController runtimeController, AvatarMask avatarMask, int layer,
            double startTime, float fade, float speed, float weight,
            ref PlayableGraph graph, ref TInput0 input0, ref TOutput output,
            params PlayableGesture.Parameter[] parameters)
            where TInput0 : struct, IPlayable
            where TOutput : struct, IPlayable
        {
            PlayableStateRTC state = new PlayableStateRTC(
                avatarMask, layer,
                fade, speed, weight
                );

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

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

            input1.SetTime(startTime);
            input1.SetSpeed(speed);

            state.Setup(ref graph, ref input0, ref input1, ref output);
            return(state);
        }
示例#2
0
        public static PlayableStateRTC CreateBefore(
            RuntimeAnimatorController runtimeController, AvatarMask avatarMask, int layer,
            double startTime, float fade, float speed, float weight,
            ref PlayableGraph graph, PlayableBase next,
            params PlayableGesture.Parameter[] parameters)
        {
            PlayableStateRTC state = new PlayableStateRTC(
                avatarMask, layer,
                fade, speed, weight
                );

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

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

            input1.SetTime(startTime);
            input1.SetSpeed(speed);

            state.Setup(ref graph, ref input1, next);
            return(state);
        }
示例#3
0
        public void SetState(RuntimeAnimatorController rtc, AvatarMask avatarMask,
                             float weight, float transition, float speed, int layer, bool syncTime,
                             params PlayableGesture.Parameter[] parameters)
        {
            PlayableState prevPlayable;
            PlayableState nextPlayable;

            int insertIndex = this.GetSurroundingStates(layer,
                                                        out prevPlayable,
                                                        out nextPlayable
                                                        );

            if (prevPlayable == null && nextPlayable == null)
            {
                this.states.Add(PlayableStateRTC.Create(
                                    rtc, avatarMask, layer,
                                    syncTime ? this.runtimeControllerPlayable.GetTime() : 0f,
                                    transition, speed, weight,
                                    ref this.graph,
                                    ref this.mixerStatesInput,
                                    ref this.mixerStatesOutput,
                                    parameters
                                    ));
            }
            else if (prevPlayable != null)
            {
                if (prevPlayable.Layer == layer)
                {
                    prevPlayable.StretchDuration(transition);
                }

                this.states.Insert(insertIndex, PlayableStateRTC.CreateAfter(
                                       rtc, avatarMask, layer,
                                       syncTime ? this.runtimeControllerPlayable.GetTime() : 0f,
                                       transition, speed, weight,
                                       ref this.graph,
                                       prevPlayable,
                                       parameters
                                       ));
            }
            else if (nextPlayable != null)
            {
                this.states.Insert(insertIndex, PlayableStateRTC.CreateBefore(
                                       rtc, avatarMask, layer,
                                       syncTime ? this.runtimeControllerPlayable.GetTime() : 0f,
                                       transition, speed, weight,
                                       ref this.graph,
                                       nextPlayable,
                                       parameters
                                       ));
            }
        }
        public static PlayableStateRTC CreateBefore(
            RuntimeAnimatorController runtimeController, AvatarMask avatarMask, int layer,
            double startTime, float fade, float speed, float weight,
            ref PlayableGraph graph, PlayableBase next)
        {
            PlayableStateRTC state = new PlayableStateRTC(
                avatarMask, layer,
                fade, speed, weight
                );

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

            input1.SetTime(startTime);
            input1.SetSpeed(speed);

            state.Setup(ref graph, ref input1, next);
            return(state);
        }