Ejemplo n.º 1
0
        private async Task PlayCurrentRound()
        {
            if (_cancellationToken.IsCancellationRequested)
            {
                return;
            }
            if (PlayerOne.PlayerType != RockPaperScissors.Common.Enums.PlayerType.HumanPlayer)
            {
                _nextPlayerOneMove = PlayerOne.GetNextMove(Game.Rules);
            }
            MoveModel move = Game.Rules.MoveList.FirstOrDefault(i => i.RuleValue == _nextPlayerOneMove);
            string    nextPlayerOneMoveDescription = move.Description;


            if (PlayerTwo.PlayerType != RockPaperScissors.Common.Enums.PlayerType.HumanPlayer)
            {
                _nextPlayerTwoMove = PlayerTwo.GetNextMove(Game.Rules);
            }
            move = Game.Rules.MoveList.FirstOrDefault(i => i.RuleValue == _nextPlayerTwoMove);
            string nextPlayerTwoMoveDescription = move.Description;

            await TurnCountDown();

            if (_cancellationToken.IsCancellationRequested)
            {
                return;
            }
            PlayerOneChoice = nextPlayerOneMoveDescription;
            PlayerTwoChoice = nextPlayerTwoMoveDescription;
            DisplayWinningMove(_nextPlayerOneMove.Value, _nextPlayerTwoMove.Value);

            await DecideNextAction();
        }