Esempio n. 1
0
 public void RequestState(SimpleState state)
 {
     if (state == null)
     {
         Debug.LogError("Requesting NULL state");
         return;
     }
     m_requestedState = state;
 }
Esempio n. 2
0
        public void UnregisterState(SimpleState state)
        {
            if (FindState(state.StateName) == null)
            {
                Debug.LogError("Can't un-register as the state is not there in state machine " + state);
                return;
            }

            //Debug.Log("Unregistered " + state);
            m_states.Remove(state.StateName);
        }
Esempio n. 3
0
        public void RegisterState(SimpleState state)
        {
            if (FindState(state.StateName) != null)
            {
                Debug.LogError("Can't re-register " + state);
                return;
            }

            //Debug.Log("Registered " + state.StateName);
            m_states.Add(state.StateName, state);
        }
Esempio n. 4
0
        void SwitchState()
        {
            if (m_requestedState == m_currentState)
            {
                return;
            }

            if (m_currentState != null)
            {
                m_currentState.OnExit();
            }
            m_stateTime = 0.0f;
            m_requestedState.OnEnter();
            m_lastState    = m_currentState;
            m_currentState = m_requestedState;
        }
Esempio n. 5
0
        public virtual void RequestState(string stateName)
        {
            if (m_debug)
            {
                Debug.Log(name + " Requested " + stateName);
            }

            SimpleState state = FindState(stateName);

            if (state == null)
            {
                Debug.LogError(name + " Requesting NULL state " + stateName);
                return;
            }
            m_requestedState = state;
        }