コード例 #1
0
    //private AnimatorController animController;

    void Start()
    {
        playableGraph = PlayableGraph.Create("ClairePlayableGraph");

        playableGraph.SetTimeUpdateMode(DirectorUpdateMode.GameTime);

        var playableOutput = AnimationPlayableOutput.Create(playableGraph, "Animation", GetComponent <Animator>());

        // Create a Mixer
        AnimationLayerMixerPlayable mixerLayerPlayable = AnimationLayerMixerPlayable.Create(playableGraph, 2);


        playableOutput.SetSourcePlayable(mixerLayerPlayable);

        // Wrap the clip in a playable

        var clipPlayable = AnimationClipPlayable.Create(playableGraph, clip);

        //var clipPlayable1 = AnimationClipPlayable.Create(playableGraph, clip1);


        // Wrap AnimController

        runtimeAnimController = GetComponent <Animator>().runtimeAnimatorController;
        //animController = (AnimatorController)animator.runtimeAnimatorController;
        var runtimeAnimControllerPlayable = AnimatorControllerPlayable.Create(playableGraph, runtimeAnimController);


        // Connect to Mixer

        playableGraph.Connect(runtimeAnimControllerPlayable, 0, mixerLayerPlayable, 1);
        playableGraph.Connect(clipPlayable, 0, mixerLayerPlayable, 0);

        mixerLayerPlayable.SetInputWeight(0, 1.0f);
        mixerLayerPlayable.SetInputWeight(1, 1.0f);

        //mixerLayerPlayable.SetLayerAdditive(0, true);
        mixerLayerPlayable.SetLayerAdditive(1, true);
        Debug.Log("Is layer 0 additive: " + mixerLayerPlayable.IsLayerAdditive(0));
        Debug.Log("Is layer 1 additive: " + mixerLayerPlayable.IsLayerAdditive(1));

        //mixerLayerPlayable.SetLayerMaskFromAvatarMask(1, headMask);

        // Connect the Playable to an output

        //playableOutput.SetSourcePlayable(clipPlayable);

        // Plays the Graph.

        playableGraph.Play();
    }
コード例 #2
0
            /************************************************************************************************************************/
            #endregion
            /************************************************************************************************************************/
            #region Layer Details
            /************************************************************************************************************************/

            /// <summary>[Pro-Only]
            /// Checks whether the layer at the specified index is set to additive blending. Otherwise it will override any
            /// earlier layers.
            /// </summary>
            public bool IsAdditive(int index)
            {
                return(LayerMixer.IsLayerAdditive((uint)index));
            }
コード例 #3
0
 public bool IsLayerAdditive(uint layerIndex)
 {
     return(layerMixer.IsLayerAdditive(layerIndex));
 }