private void OnStateChanged(IPlayerState newState) { if (_currentState != null) { _currentState.StateChanged -= OnStateChanged; _currentState.ResetState(); } newState.StateChanged += OnStateChanged; newState.PrepareState(); _currentState = newState; }