Esempio n. 1
0
        static public void Play(Animator animator, Playable playable, PlayableGraph graph)
        {
            AnimationPlayableOutput playableOutput = AnimationPlayableOutput.Create(graph, "AnimationClip", animator);

            playableOutput.SetSourcePlayable(playable, 0);
            graph.SyncUpdateAndTimeMode(animator);
            graph.Play();
        }
        public static AnimationLayerMixerPlayable PlayLayerMixer(Animator animator, int inputCount, out PlayableGraph graph)
        {
            graph = PlayableGraph.Create();
            AnimationPlayableOutput     output = AnimationPlayableOutput.Create(graph, "Mixer", animator);
            AnimationLayerMixerPlayable animationLayerMixerPlayable = AnimationLayerMixerPlayable.Create(graph, inputCount);

            output.SetSourcePlayable(animationLayerMixerPlayable);
            graph.SyncUpdateAndTimeMode(animator);
            graph.Play();
            return(animationLayerMixerPlayable);
        }
        public static AnimatorControllerPlayable PlayAnimatorController(Animator animator, RuntimeAnimatorController controller, out PlayableGraph graph)
        {
            graph = PlayableGraph.Create();
            AnimationPlayableOutput    output = AnimationPlayableOutput.Create(graph, "AnimatorControllerPlayable", animator);
            AnimatorControllerPlayable animatorControllerPlayable = AnimatorControllerPlayable.Create(graph, controller);

            output.SetSourcePlayable(animatorControllerPlayable);
            graph.SyncUpdateAndTimeMode(animator);
            graph.Play();
            return(animatorControllerPlayable);
        }
        public static AnimationClipPlayable PlayClip(Animator animator, AnimationClip clip, out PlayableGraph graph)
        {
            graph = PlayableGraph.Create();
            AnimationPlayableOutput output = AnimationPlayableOutput.Create(graph, "AnimationClip", animator);
            AnimationClipPlayable   animationClipPlayable = AnimationClipPlayable.Create(graph, clip);

            output.SetSourcePlayable(animationClipPlayable);
            graph.SyncUpdateAndTimeMode(animator);
            graph.Play();
            return(animationClipPlayable);
        }
        static public AnimationMixerPlayable PlayMixer(Animator animator, int inputCount, out PlayableGraph graph)
        {
            graph = PlayableGraph.Create();
            AnimationPlayableOutput playableOutput = AnimationPlayableOutput.Create(graph, "Mixer", animator);
            var mixer = AnimationMixerPlayable.Create(graph, inputCount);

            playableOutput.SetSourcePlayable(mixer);
            graph.SyncUpdateAndTimeMode(animator);
            graph.Play();

            return(mixer);
        }