Example #1
0
        /// <summary>
        /// This method refers to the Player class method called
        /// 'AddSettlementToSettlementListOfPlayer(Settlement,int,int,Player)'
        /// This AddSettlementToSettlementListOfPlayer method does what it
        /// suggests: it adds a settlement to the player's list of settlements.
        ///
        /// </summary>
        /// <param name="squareTileManagement">the object pertaining to the </param>
        /// <param name="tileHelper"></param>
        /// <param name="isTurnOfPlayerOne"></param>
        public void EstablishSettlementAndWhatNot(SquareTile squareTileManagement, TileHelper tileHelper, bool isTurnOfPlayerOne)
        {
            if (playerObj.HasToEstablishASettlementThisTurn)
            {
                //this if-statement prevents the player from placing a settlement
                //on another settlement, water or a mountain.
                if (squareTileManagement.selectedTileStruct.tile != TileType.Settlement &&
                    squareTileManagement.selectedTileStruct.tile != TileType.SettlementBlue &&
                    squareTileManagement.selectedTileStruct.tile != TileType.SettlementRed &&
                    squareTileManagement.selectedTileStruct.tile != TileType.Water &&
                    squareTileManagement.selectedTileStruct.tile != TileType.Mountain)
                {
                    //aesthetically makes the tile into a settlement
                    squareTileManagement.MakeTileIntoSettlement(tileHelper, isTurnOfPlayerOne);
                    //debug statement
                    Console.WriteLine("making tile into a settlement");

                    //Indicates that the player no longer has to set
                    //up a settlement
                    playerObj.HasToEstablishASettlementThisTurn = false;
                    //Adds the settlement to the list
                    playerObj.AddSettlementToSettlementListOfPlayer(new Settlement("",
                                                                                   squareTileManagement.selectedTileStruct.x,
                                                                                   squareTileManagement.selectedTileStruct.y, playerObj));
                }
            }
        }
Example #2
0
 /// <summary>
 /// This method refers to the Player class method called
 /// 'AddSettlementToSettlementListOfPlayer(Settlement,int,int,Player)'
 /// This AddSettlementToSettlementListOfPlayer method does what it
 /// suggests: it adds a settlement to the player's list of settlements.
 ///
 /// It also refers to the square tile management method called 'MakeTileIntoSettlement'
 /// which aesthetically transforms a given tile into a settlement tile
 ///
 /// @@@@This version of EstablishSettlementAndWhatNot is not actually used.@@@@
 /// The overloaded one is (which is down below)
 ///
 /// </summary>
 /// <param name="squareTileManagement"></param>
 /// <param name="tileHelper"></param>
 public void EstablishSettlementAndWhatNot(SquareTile squareTileManagement, TileHelper tileHelper)
 {
     // Checks if the player has a settlement they can place.
     if (playerObj.HasToEstablishASettlementThisTurn)
     {
         // Checks if the selected tile is a valid placement spot.
         if (squareTileManagement.selectedTileStruct.tile != TileType.Settlement &&
             squareTileManagement.selectedTileStruct.tile != TileType.Water &&
             squareTileManagement.selectedTileStruct.tile != TileType.Mountain)
         {
             squareTileManagement.MakeTileIntoSettlement(tileHelper);
             Console.WriteLine("making tile into a settlement");
             playerObj.HasToEstablishASettlementThisTurn = false;
             playerObj.AddSettlementToSettlementListOfPlayer(new Settlement("",
                                                                            squareTileManagement.selectedTileStruct.x,
                                                                            squareTileManagement.selectedTileStruct.y, playerObj));
         }
     }
 }