// Update is called once per frame public void Update() { if (m_nextState != m_currState) { m_currState.ExitState(); m_currState = m_nextState; m_currState.EnterState(); } if (m_currState != null) { m_currState.UpdateState(); } }
/// <summary> /// This is where the updating of changing in states takes place /// </summary> public void Update() { // if next state != current state, change current to be next state if (m_nextState != m_currState) { m_currState.ExitState(); m_currState = m_nextState; m_currState.EnterState(); } // Update the curr state m_currState.UpdateState(); //DebugLogger.Log<StateMachine>("Curr State: " + m_currState + " Next State: " + m_nextState); }