Esempio n. 1
0
        private void Initialize()
        {
            if (m_IsInitialized)
            {
                return;
            }
            m_Animator = GetComponent <Animator>();
            if (m_Animator != null)
            {
                Destroy(m_Animator);
            }
            m_Animator = gameObject.AddComponent <Animator>();

            m_Graph = PlayableGraph.Create();
            m_Graph.SetTimeUpdateMode(DirectorUpdateMode.Manual);
            m_StateController = new PlayableStateController(m_Graph);

            var template = new PlayableAmimatorDriver();

            template.Initialize(m_Graph, m_StateController);
            m_OutputPlayable = ScriptPlayable <PlayableAmimatorDriver> .Create(m_Graph, template, 1);

            AnimationPlayableUtilities.Play(m_Animator, m_OutputPlayable, m_Graph);

            m_Graph.Stop();

            updateObject = new UpdateObject(this, UpdateGraph, mode);
            PlayableUpdateManager.Reg(updateObject);
            m_IsInitialized = true;
        }
Esempio n. 2
0
 private void OnDestroy()
 {
     PlayableUpdateManager.UnReg(updateObject);
     m_Graph.Destroy();
 }