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();
    }
예제 #3
0
파일: Fsm.cs 프로젝트: igli15/Circly-Fly
 private void ChangeState(AbstractState <T> pNewState)
 {
     if (_currentState == pNewState)
     {
         return;
     }
     if (_currentState != null)
     {
         _currentState.Exit(_target);
     }
     _currentState = pNewState;
     if (_currentState != null)
     {
         _currentState.Enter(_target);
     }
 }