Exemplo n.º 1
0
        public double GetLemonQuantityAndCost(Player player)
        {
            Lemon lemon = new Lemon();

            Console.WriteLine("How many lemons would you like to buy? 1-100");
            string UserInput         = Console.ReadLine();
            int    UserLemonQuantity = Int32.Parse(UserInput);

            ItemCost = lemon.GetLemonCost() * UserLemonQuantity;
            if (ItemCost > player.CurrentMoney.Money)
            {
                Console.WriteLine("You do not have enough money");
                return(player.CurrentMoney.Money);
            }
            else
            {
                player.CurrentMoney.Money = player.CurrentMoney.Money - ItemCost;
                Console.WriteLine("You bought " + UserLemonQuantity + " lemons and now have $" + Math.Round(player.CurrentMoney.Money, 2));
                player.CurrentInventory.InventoryLemons = UserLemonQuantity + player.CurrentInventory.InventoryLemons;
                Console.WriteLine("You now have " + player.CurrentInventory.InventoryLemons + " in your inventory");
                return(player.CurrentMoney.Money);
            }
        }