Ejemplo n.º 1
0
        /// <summary>
        /// Sets everything up for the next turn and switches to the next player
        /// </summary>
        public static void NextTurn()
        {
            // Remove the unplaceable squares
            CurrentPlayer.RemoveDeadSquares();
            // Reset the player's ability to place squares
            CurrentPlayer.CanPlaceSquare(true);
            // Make the place take new squares
            OwnerFrame.GetGridPanel().TakeSquare(CurrentPlayer);

            // Switch to the next player
            Players.Add(Players[0]);
            Players.RemoveAt(0);
            CurrentPlayer = Players[0];

            // Update the player display
            OwnerFrame.UpdatePlayerList();
            // Update the square highlighting
            OwnerFrame.GetGridPanel().UpdateHeldSquares(CurrentPlayer);
            // Reset the amount of stock this player can buy
            CurrentPlayer.NumBuysLeft = 3;

            // Reset the end turn button
            EndTurnCheck();
            // Clear the current dynamic content
            LogMaster.ClearDynamicContent();
            // Tell the users whose turn it is
            LogMaster.Log("It is now " + CurrentPlayer.Name + "'s turn.");

            // If this is an AI player, make them take their turn
            if (CurrentPlayer.Type == PlayerType.AI)
            {
                ((IAIPlayer)CurrentPlayer).TakeTurn();
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Checks whether or not the turn is endable.
 /// Enables or disables the end turn button as necessary
 /// </summary>
 public static void EndTurnCheck()
 {
     if (CurrentPlayer.CanPlaceSquare() && CurrentPlayer.Squares.Count > 0)
     {
         OwnerFrame.SetEndTurnButtonEnabled(false);
     }
     else if (!IsGameOver)
     {
         OwnerFrame.SetEndTurnButtonEnabled(true);
     }
 }