Beispiel #1
0
        /// <summary>
        /// Buys and places a plant
        /// </summary>
        /// <param name="row">Row</param>
        /// <param name="col">Column</param>
        /// <param name="plant">Plant to place</param>
        internal void BuyAndPlace(int row, int col, Plant plant)
        {
            //Check if the row and column are valid
            if (_wrapper.CheckPlace(row, col, plant.Bounds, plant) && _vars.GetMoons() >= plant.GetPrice())
            {
                //Place the plant
                _vars.board[row, col] = plant;

                //Make the player lose moons
                _vars.AddMoons(-plant.GetPrice());
            }
        }
Beispiel #2
0
 /// <summary>
 /// Gets the amount of moons the player has
 /// </summary>
 /// <returns>The player's moon count</returns>
 public int GetPlayerMoons()
 {
     return(_vars.GetMoons());
 }