public void ChangeState(IState nextState) { if (ActiveState != null) { ActiveState.OnExit(); } nextState.OnStart(); ActiveState = nextState; foreach (ITransition transition in nextState.Transitions) { transition.InitTransition(); } }