public void SetState(AbstractState state) { if (_state != null) { _state.Exit(this); } _state = state; _state.Enter(this); }
public void ChangeState(AbstractState newState) { if (_currentState == newState) { return; } _currentState.Exit(); _currentState = newState; _currentState.Enter(); }
private void ChangeState(AbstractState <T> pNewState) { if (_currentState == pNewState) { return; } if (_currentState != null) { _currentState.Exit(_target); } _currentState = pNewState; if (_currentState != null) { _currentState.Enter(_target); } }