Пример #1
0
        public void EndTurn()
        {
            var player = Game.WhoseTurnIsIt();

            if (player.HasFinished == false && player.HasPlayerFinished())
            {
                player.FinishPosition = Game.GetFinishPosition();
                player.HasFinished    = true;

                // Congratulate Player
                MessageBox.Show($"Congratulations player {player.PlayerNumber + 1}! You finished {player.FinishPosition}");
            }

            if (CanPlayerGoAgain(player))
            {
                AddMessageToHistoryList($"P{player.PlayerNumber + 1} can go again!");
                ++player.NumberOfRolls;
            }
            else
            {
                player.NumberOfRolls = 0;
                Game.NextPlayerTurn();
            }

            player.HasMoved = false;
            player.DieRoll  = 0;

            Context.SaveChanges();
        }