public static PlayableStateCharacter CreateBefore(
            CharacterState stateAsset, AvatarMask avatarMask,
            CharacterAnimation character, int layer,
            double startTime, float fade, float speed, float weight,
            ref PlayableGraph graph, PlayableBase next)
        {
            PlayableStateCharacter state = new PlayableStateCharacter(
                stateAsset, avatarMask,
                character, layer,
                fade, speed, weight
                );

            AnimatorControllerPlayable input1 = AnimatorControllerPlayable.Create(
                graph,
                stateAsset.GetRuntimeAnimatorController()
                );

            if (stateAsset.enterClip != null)
            {
                float offsetTime = Mathf.Max(0.15f, fade);
                input1.SetDelay(offsetTime);
            }

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

            state.Setup(ref graph, ref input1, next);
            return(state);
        }
Beispiel #2
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);
        }
Beispiel #3
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);
        }
Beispiel #4
0
        public static PlayableStateCharacter CreateAfter(
            CharacterState stateAsset, AvatarMask avatarMask,
            CharacterAnimation character, int layer,
            double startTime, float fade, float speed, float weight,
            ref PlayableGraph graph, PlayableBase previous,
            params PlayableGesture.Parameter[] parameters)
        {
            PlayableStateCharacter state = new PlayableStateCharacter(
                stateAsset, avatarMask,
                character, layer,
                fade, speed, weight
                );

            AnimatorControllerPlayable input1 = AnimatorControllerPlayable.Create(
                graph,
                stateAsset.GetRuntimeAnimatorController()
                );

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

            if (stateAsset.enterClip != null)
            {
                float offsetTime = Mathf.Max(0.15f, fade);
                input1.SetDelay(offsetTime);
            }

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

            state.Setup(ref graph, previous, ref input1);
            return(state);
        }
Beispiel #5
0
        protected void Setup <TInput1>(
            ref PlayableGraph graph, ref TInput1 input1, PlayableBase next)
            where TInput1 : struct, IPlayable
        {
            Playable input0 = next.Input0;
            Playable output = next.Mixer;

            output.DisconnectInput(0);

            this.SetupMixer(ref graph, ref input0, ref input1, ref output);
        }
Beispiel #6
0
        protected void Setup <TInput1>(
            ref PlayableGraph graph, PlayableBase previous, ref TInput1 input1)
            where TInput1 : struct, IPlayable
        {
            Playable input0 = previous.Mixer;
            Playable output = previous.Output;

            previous.Output.DisconnectInput(0);

            this.SetupMixer(ref graph, ref input0, ref input1, ref output);
        }
Beispiel #7
0
        public static PlayableState CreateBefore(
            AnimationClip animationClip, AvatarMask avatarMask, int layer,
            double startTime, float fade, float speed, float weight,
            ref PlayableGraph graph, PlayableBase next)
        {
            PlayableStateClip state = new PlayableStateClip(
                animationClip, avatarMask,
                layer, fade, speed, weight
                );

            AnimationClipPlayable input1 = AnimationClipPlayable.Create(graph, animationClip);

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

            state.Setup(ref graph, ref input1, next);
            return(state);
        }
        public static PlayableGesture CreateAfter(
            AnimationClip animationClip, AvatarMask avatarMask,
            float fadeIn, float fadeOut, float speed,
            ref PlayableGraph graph, PlayableBase previous)
        {
            PlayableGesture gesture = new PlayableGesture(
                animationClip, avatarMask,
                fadeIn, fadeOut, speed
                );

            AnimationClipPlayable input1 = AnimationClipPlayable.Create(graph, animationClip);

            input1.SetTime(0f);
            input1.SetSpeed(speed);
            input1.SetDuration(animationClip.length);

            gesture.Setup(ref graph, previous, ref input1);
            return(gesture);
        }
        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);
        }
        public static PlayableStateCharacter CreateAfter(
            CharacterState stateAsset, AvatarMask avatarMask,
            CharacterAnimation character, int layer,
            double startTime, float fade, float speed, float weight,
            ref PlayableGraph graph, PlayableBase previous)
        {
            PlayableStateCharacter state = new PlayableStateCharacter(
                stateAsset, avatarMask,
                character, layer,
                fade, speed, weight
                );

            AnimatorControllerPlayable input1 = AnimatorControllerPlayable.Create(
                graph,
                stateAsset.GetRuntimeAnimatorController()
                );

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

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