public void OnUpdate() { if (newState != null) { if (curState != null) { curState.OnExit(); } curState = newState; newState = null; curState.OnEnter(); } if (curState != null) { curState.OnUpdate(); } }
// public void OnUpdate() { if (m_newState != null) { if (m_curState != null) { m_curState.OnExit(); } m_curState = m_newState; m_newState = null; m_curState.OnEnter(); } if (m_curState != null) { m_curState.OnUpdate(); } }
public void OnUpdate() { // [New State 발생] > [현재상태 -> 종료하기] > [현재상태 -> 최신상태로] > [New State -> 초기화] > [현재상태 -> 입장] > [현재상태 -> 활동] // Cur State - OnExit() Cur State = New State New State = null Cur State - OnEnter Cur State - OnUpdate() if (m_newState != null) { if (m_curState != null) { m_curState.OnExit(); } m_curState = m_newState; m_newState = null; m_curState.OnEnter(); } if (m_curState != null) { m_curState.OnUpdate(); } }