コード例 #1
0
ファイル: Store.cs プロジェクト: ctcb57/lemonade_Stand
        public int SellCups(Player player, Inventory inventory)
        {
            UserInterface.PurchaseCupsPrompt();
            int response;

            while (!int.TryParse(Console.ReadLine(), out response) || player.CashOnHand < (cupPrice * response))
            {
                UserInterface.InvalidCupsResponse();
            }
            player.CashOnHand  -= (cupPrice * response);
            inventory.CupCount += (1 * response);
            int moneySpentOnCups = cupPrice * response;

            return(moneySpentOnCups);
        }