Exemple #1
0
        public void StartRound()
        {
            gameView.ClearConsole();
            gameView.DisplayPlayerScore(player.GetScores());
            game.Roll();
            model.Dice dice = game.GetDice();
            gameView.DisplayDiceValues(dice);
            List <model.Scores> options = game.GetPlayerOptions();

            gameView.DislayPlayerOptions(options);
            ConsoleKeyInfo userInput = gameView.GetInput();

            if (userInput.Key == ConsoleKey.D1)
            {
                StartRound();
            }
            else if (userInput.Key == ConsoleKey.D2)
            {
                SelectDice(dice);
            }
            else if (userInput.Key == ConsoleKey.D3)
            {
                if (options.Count > 0)
                {
                    player.AddScore(options[0], dice);
                }
            }
            else if (userInput.Key == ConsoleKey.D4)
            {
                if (options.Count > 1)
                {
                    player.AddScore(options[1], dice);
                }
            }
            else if (userInput.Key == ConsoleKey.D5)
            {
                if (options.Count > 2)
                {
                    player.AddScore(options[2], dice);
                }
            }
            else if (userInput.Key == ConsoleKey.D6)
            {
                if (options.Count > 3)
                {
                    player.AddScore(options[3], dice);
                }
            }
            else if (userInput.Key == ConsoleKey.D7)
            {
                if (options.Count > 4)
                {
                    player.AddScore(options[4], dice);
                }
            }
            StartRound();
        }