Exemplo n.º 1
0
        private void Initialize()
        {
            if (m_Initialized)
            {
                return;
            }

            m_Animator             = GetComponent <Animator>();
            m_Animator.updateMode  = m_AnimatePhysics ? AnimatorUpdateMode.AnimatePhysics : AnimatorUpdateMode.Normal;
            m_Animator.cullingMode = m_CullingMode;
            m_Graph = PlayableGraph.Create();
            m_Graph.SetTimeUpdateMode(DirectorUpdateMode.GameTime);
            SimpleAnimationPlayable template = new SimpleAnimationPlayable();

            var playable = ScriptPlayable <SimpleAnimationPlayable> .Create(m_Graph, template, 1);

            m_Playable         = playable.GetBehaviour();
            m_Playable.onDone += OnPlayableDone;
            if (m_States == null)
            {
                m_States    = new EditorState[1];
                m_States[0] = new EditorState();
                m_States[0].defaultState = true;
                m_States[0].name         = "Default";
            }


            if (m_States != null)
            {
                foreach (var state in m_States)
                {
                    if (state.clip)
                    {
                        m_Playable.AddClip(state.clip, state.name);
                    }
                }
            }

            EnsureDefaultStateExists();

            AnimationPlayableUtilities.Play(m_Animator, m_Playable.playable, m_Graph);
            Play();
            Kick();
            m_Initialized = true;
        }
Exemplo n.º 2
0
 public StateEnumerator(SimpleAnimationPlayable owner)
 {
     m_Owner   = owner;
     m_Version = m_Owner.m_StatesVersion;
     Reset();
 }
Exemplo n.º 3
0
 public StateEnumerable(SimpleAnimationPlayable owner)
 {
     m_Owner = owner;
 }
Exemplo n.º 4
0
 public StateHandle(SimpleAnimationPlayable s, int index, Playable target)
 {
     m_Parent = s;
     m_Index  = index;
     m_Target = target;
 }