Example #1
0
 protected void InitFSM()
 {
     if (m_StateMachine == null)
     {
         m_StateMachine = new FStateMachine(name, m_States.Length, m_Transitions.Length);
         m_StateMachine.MaxStackSize = m_StackSize;
         MonoBehaviour impl = m_OtherImplement ?? this;
         for (int i = 0; i < m_States.Length; i++)
         {
             FiniteState state = m_States[i];
             if (state.Init(impl))
             {
                 m_StateMachine.AddState(state, state.m_IsDefaultState);
             }
         }
         for (int i = 0; i < m_Transitions.Length; i++)
         {
             FiniteStateTransition trans = m_Transitions[i];
             if (trans.Init(impl))
             {
                 m_StateMachine.AddTransition(trans.m_FromState, trans.m_ToState, trans);
             }
         }
     }
 }
Example #2
0
 protected virtual void OnDestroy()
 {
     if (m_StateMachine != null)
     {
         m_StateMachine.Release();
         m_StateMachine = null;
     }
 }