public void SetActiveState(TStateEnum type) { m_CurrentState?.Stopped(ref Data); m_CurrentState = m_States[type]; var previousState = m_CurrentStateType; m_CurrentStateType = type; m_CurrentState.Started(previousState, ref Data); }