Beispiel #1
0
 void Awake()
 {
     _currentState = new DisconnectedStateView(this);
     _currentState.EnterState();
 }
Beispiel #2
0
        private void UpdatePlayerStateView(PlayerState state)
        {
            UnityEngine.Debug.Log($"UpdatePlayerStateView newState: {state}", this);
            _currentState.ExitState();

            switch (state)
            {
            case PlayerState.Disconnected:
                _currentState = new DisconnectedStateView(this);
                break;

            case PlayerState.Connected:
                _currentState = new ConnectedStateView(this);
                break;

            case PlayerState.WaitOtherPlayerBidding:
                _currentState = new WaitOtherPlayerBiddingStateView(this);
                break;

            case PlayerState.Bidding:
                _currentState = new BiddingStateView(this);
                break;

            case PlayerState.GetRiddingOfTwoExtraCards:
                _currentState = new GetRiddingOfTwoExtraCardsStateView(this);
                break;

            case PlayerState.WaitOtherPlayerMove:
                _currentState = new WaitOtherPlayerMoveStateView(this);
                break;

            case PlayerState.MakingMove:
                _currentState = new MakingMoveStateView(this);
                break;

            case PlayerState.MakingMoveOrPass:
                _currentState = new MakingMoveOrPassStateView(this);
                break;

            case PlayerState.LeftRound:
                _currentState = new LeavedRoundStateView(this);
                break;

            case PlayerState.WatchingHandResult:
                _currentState = new WatchingHandResultStateView(this);
                break;

            case PlayerState.LeftRoundWatchingHandResult:
                _currentState = new LeavedRoundWatchingHandResultStateView(this);
                break;

            case PlayerState.WatchingRoundResult:
                _currentState = new WatchingRoundResultsStateView(this);
                break;

            case PlayerState.WaitingForNewRound:
                _currentState = new WaitingForNewRoundStateView(this);
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(state), state, null);
            }

            _currentState.EnterState();
        }