示例#1
0
        public int SellSugar(Player player, Inventory inventory)
        {
            UserInterface.PurchaseSugarPrompt();
            int response;

            while (!int.TryParse(Console.ReadLine(), out response) || player.CashOnHand < (sugarPrice * response))
            {
                UserInterface.InvalidSugarResponse();
            }
            player.CashOnHand    -= (sugarPrice * response);
            inventory.SugarCount += (1 * response);
            int moneySpentOnSugar = sugarPrice * response;

            return(moneySpentOnSugar);
        }