public void SetState(ViewMode new_state) { if (m_states[new_state] == m_current_state) { return; } if (m_current_state != null) { m_current_state.StateExit(this); } m_current_state = m_states[new_state]; m_current_state.StateEnter(this); }