コード例 #1
0
        void Restore()
        {
            if (animator != null)
            {
                animator.runtimeAnimatorController = wasController;
                animator.applyRootMotion           = wasRootMotion;
                animator.cullingMode = wasCullingMode;
                animator.enabled     = wasEnabled;
            }

#if UNITY_2017_1_OR_NEWER
            if (graph.IsValid())
            {
                graph.Destroy();
            }
#elif UNITY_5_6_OR_NEWER
            if (graph.IsValid())
            {
                graph.Destroy();
            }
#else
            mixerPlayable.Destroy();
            if (Application.isPlaying && animator.runtimeAnimatorController != null)
            {
                RestoreAnimatorInfo();
            }
#endif
        }
コード例 #2
0
        /************************************************************************************************************************/
#endif
        /************************************************************************************************************************/

        /// <summary>
        /// Called by Unity when this component is first created.
        /// <para></para>
        /// Initialises everything needed to play the <see cref="Clip"/>.
        /// </summary>
        private void Awake()
        {
            if (_Clip == null || _Animator == null)
            {
                return;
            }

            if (_Graph.IsValid())
            {
                _Graph.Destroy();
            }

            _Playable = AnimationPlayableUtilities.PlayClip(_Animator, _Clip, out _Graph);

            _Playable.SetSpeed(_Speed);

            if (!_FootIK)
            {
                _Playable.SetApplyFootIK(false);
            }

            if (!_Clip.isLooping)
            {
                _Playable.SetDuration(_Clip.length);
            }
        }
コード例 #3
0
 void ResetAnim()
 {
     m_Graph.Destroy();
     m_Handles.Dispose();
     m_BoneWeights.Dispose();
     OnEnable();
 }
コード例 #4
0
        public void StopPreviewing()
        {
            IsShowingPreview = false;

            previewGraph.Destroy();

            animationPlayer.gameObject.GetComponent <Animator>().Update(0f);
        }
コード例 #5
0
 void OnApplicationQuit()
 {
     if (haveGraph)
     {
         graph.Destroy();
     }
     haveGraph = false;
 }
コード例 #6
0
ファイル: PlayAnimation.cs プロジェクト: lindenreid/GGJ18
 public void PlayClip(AnimationClip c, bool randomStart)
 {
     if (playableGraph.IsValid())
     {
         playableGraph.Destroy();
     }
     clip = c;
     Play(randomStart);
 }
コード例 #7
0
    private void Reset()
    {
        if (m_Graph.IsValid())
        {
            m_Graph.Destroy();
        }

        m_Initialized = false;
    }
コード例 #8
0
 private void OnDestroy()
 {
     if (graph.IsValid())
     {
         graph.Destroy();
     }
 }
コード例 #9
0
 void OnDisable()
 {
     if (playableGraph.IsValid())
     {
         playableGraph.Destroy();
     }
 }
コード例 #10
0
 private void OnDisable()
 {
     if (m_graph.IsValid())
     {
         m_graph.Destroy();
     }
 }
コード例 #11
0
 public override void OnPlayableDestroy(Playable playable)
 {
     if (playableGraph.IsValid())
     {
         playableGraph.Destroy();
     }
 }
コード例 #12
0
 void OnDisable()
 {
     m_Graph.Destroy();
     emptyGraph.Destroy();
     m_Handles.Dispose();
     m_BoneWeights.Dispose();
 }
コード例 #13
0
 public void Release()
 {
     if (_playableGraph.IsValid())
     {
         _playableGraph.Destroy();
     }
 }
コード例 #14
0
            public void Release()
            {
#if UNITY_2018_3_OR_NEWER
#if VERYANIMATION_ANIMATIONRIGGING
                if (m_RigBuilder != null)
                {
                    m_RigBuilder.StopPreview();
                }
                if (m_VARigBuilder != null)
                {
                    m_VARigBuilder.StopPreview();
                }
#endif
                if (m_PlayableGraph.IsValid())
                {
                    m_PlayableGraph.Destroy();
                }
#else
                if (animator != null)
                {
                    animator.enabled = true;   //In order to avoid the mysterious behavior where an event is called from "UnityEditor.Handles: DrawCameraImpl", it is invalid except when updating
                }
#endif
                #region Save
                if (animator != null)
                {
                    animator.fireEvents = saveFireEvents;
                }
                #endregion

                animationClipValueSave.ResetValue();
                transformPoseSave.ResetOriginalTransform();
                blendShapeWeightSave.ResetOriginalWeight();
            }
コード例 #15
0
 /// <summary>
 /// This function is called when the MonoBehaviour will be destroyed.
 /// </summary>
 void OnDestroy()
 {
     if (_playableGraph.IsValid())
     {
         _playableGraph.Destroy();
     }
 }
コード例 #16
0
 public void Dispose()
 {
     if (m_Graph.IsValid())
     {
         m_Graph.Destroy();
     }
 }
コード例 #17
0
    void OnDisable()

    {
        // Destroys all Playables and Outputs created by the graph.

        playableGraph.Destroy();
    }
コード例 #18
0
 public void OnDestroy()
 {
     if (graph.IsValid())
     {
         graph.Destroy();
     }
 }
コード例 #19
0
 protected void Cleanup()
 {
     if (graph.IsValid())
     {
         graph.Stop();
     }
     if (mixerCoroutine != null)
     {
         StopCoroutine(mixerCoroutine);
         mixerCoroutine = null;
     }
     if (currentPlayable.IsValid())
     {
         currentPlayable.Destroy();
     }
     if (previousPlayable.IsValid())
     {
         previousPlayable.Destroy();
     }
     if (mixer.IsValid())
     {
         mixer.Destroy();
     }
     if (graph.IsValid())
     {
         graph.Destroy();
     }
 }
コード例 #20
0
 private void OnDestroy()
 {
     if (playableGraph.IsValid())
     {
         playableGraph.Destroy();
     }
 }
コード例 #21
0
        /// <summary>
        /// Use animation Playables API to control keyed values, blended between the first frame of 2 animation clips.
        /// </summary>
        /// <param name="valueForAdaptationCurve">A value to evaluate into adaptation curve producing a real blend value for 2 clips.</param>
        /// <param name="animator">The control target for animation playables. The clips used must be able to control the keyed fields traveling down from this animator component.</param>
        public void Adapt(float valueForAdaptationCurve, Animator animator)
        {
            if (!Adaptable)
            {
                return;
            }

            float blend = adaptationCurve.Evaluate(valueForAdaptationCurve);

            //Connect up a playable graph, evaluate once, then we're done with them.
            PlayableGraph pg = PlayableGraph.Create("AdaptationGraph");

            pg.SetTimeUpdateMode(DirectorUpdateMode.Manual);

            var mixer = AnimationMixerPlayable.Create(pg, 2, normalizeWeights: true);

            //Not sure if the mixer should be "cross fade" like this, or should we do 0~1 weight over 1 weight?
            //But I think that's for AnimationLayerMixerPlayable ?
            mixer.SetInputWeight(inputIndex: 0, weight: 1 - blend);
            mixer.SetInputWeight(inputIndex: 1, weight: blend);


            var normalStateAcp       = AnimationClipPlayable.Create(pg, normalState);
            var fullyAdaptedStateAcp = AnimationClipPlayable.Create(pg, fullyAdaptedState);

            pg.Connect(normalStateAcp, sourceOutputPort: 0, mixer, destinationInputPort: 0);
            pg.Connect(fullyAdaptedStateAcp, sourceOutputPort: 0, mixer, destinationInputPort: 1);

            var output = AnimationPlayableOutput.Create(pg, "AdaptationGraphOutput", animator);

            output.SetSourcePlayable(mixer);

            pg.Evaluate();
            pg.Destroy();
        }
コード例 #22
0
ファイル: Player.cs プロジェクト: JoshHux/FantasyCrescendoECS
 void OnDestroy()
 {
     if (_graph.IsValid())
     {
         _graph.Destroy();
     }
 }
コード例 #23
0
 public void OnDestroy()
 {
     if (m_Graph.IsValid())
     {
         m_Graph.Destroy();
     }
 }
コード例 #24
0
        private void OnDestroy()
        {
            #if UNITY_EDITOR
            GraphVisualizerClient.Hide(_graph);
            #endif

            _graph.Destroy();
        }
コード例 #25
0
 void OnDisable()
 {
     if (m_PlayableGraph.IsValid())
     {
         m_AnimGraph.Shutdown();
         m_PlayableGraph.Destroy();
     }
 }
コード例 #26
0
 protected virtual void OnDestroy()
 {
     if (_graph.IsValid())
     {
         _graph.Stop();
         _graph.Destroy();
     }
 }
コード例 #27
0
 /// <summary>
 /// Called by Unity.
 /// </summary>
 private void OnDisable()
 {
     // Destroy _playableGrap.
     if (_playableGrap.IsValid())
     {
         _playableGrap.Destroy();
     }
 }
コード例 #28
0
 void OnDestroy()
 {
     // Destroys all Playables and Outputs created by the graph.
     if (playableGraph.IsValid())
     {
         playableGraph.Destroy();
     }
 }
コード例 #29
0
        //...
        protected override void OnExit()
        {
            if (isMasterTrack)
            {
                animator.applyRootMotion = wasRootMotion;
                animator.cullingMode     = wasCullingMode;
                if (graph.IsValid())
                {
                    graph.Destroy();
                }

                if (useRootMotion)
                {
                    ApplyBakedRootMotion(endTime - startTime);
                }
            }
        }
コード例 #30
0
 void DisposeGraph()
 {
     if (g.IsValid())
     {
         g.Stop();
         g.Destroy();
     }
 }