コード例 #1
0
ファイル: Store.cs プロジェクト: alynielson/LemonadeStand
        private void purchaseItems(int numberChoice, Inventory itemToShopFor, Player player)
        {
            double priceToUse        = DeterminePriceToUse(numberChoice);
            int    qtyToUse          = DetermineQuantityToUse(numberChoice);
            bool   isShopperBankrupt = player.CheckIfBankrupt(priceToUse);

            if (isShopperBankrupt == false)
            {
                DoTransaction(itemToShopFor, player, qtyToUse, priceToUse);
            }
            else
            {
                player.isStillShopping = false;
                player.DeclareBankruptcy();
            }
            if (player.isGameOver == false)
            {
                Console.Clear();
                Console.WriteLine($"{player.name}, you now have ${player.totalMoney} and {itemToShopFor.quantity} {itemToShopFor.name}.");
            }
        }