コード例 #1
0
 public PlayerAttack()
 {
     NormalState    = new PlayerNormalState(this);
     EnhanceState   = new PlayerEnhanceState(this);
     ParalysisState = new PlayerParalysisState(this);
     _currentState  = NormalState;
 }
コード例 #2
0
    public void ChangeState(AbstractPlayerState newState)
    {
        Debug.Log($"Transitioning from {_currentState?.GetType()} to {newState?.GetType()}");
        var oldState = _currentState;

        _currentState = newState;

        oldState?.OnStateExit();
        newState.OnStateEnter();
    }
コード例 #3
0
 public void SetState(AbstractPlayerState state)
 {
     _currentState = state;
 }