コード例 #1
0
        public void ChoosingIceCubes(Player player, Inventory inventory, Wallet wallet)
        {
            Console.WriteLine("Type in the number of ice cubes you want to buy");
            option = Console.ReadLine();
            switch (option)
            {
            case "100":
                Console.WriteLine("You bought 100 ice cubes.");
                player.numberOfItemsBought = 100;
                cost = priceOf100IceCubes;
                wallet.ValidatingFunds(player, cost);
                inventory.AddingIceCubes(player);
                buyingMore(player, inventory, wallet);
                break;

            case "250":
                Console.WriteLine("You bought 250 ice cubes.");
                player.numberOfItemsBought = 250;
                cost = priceOf250IceCubes;
                wallet.ValidatingFunds(player, cost);
                inventory.AddingIceCubes(player);
                buyingMore(player, inventory, wallet);
                break;

            case "500":
                Console.WriteLine("You bought 500 ice cubes.");
                player.numberOfItemsBought = 500;
                cost = priceOf500IceCubes;
                wallet.ValidatingFunds(player, cost);
                inventory.AddingIceCubes(player);
                buyingMore(player, inventory, wallet);
                break;

            default:
                Console.WriteLine("You typed in something wrong.");
                ChoosingIceCubes(player, inventory, wallet);
                break;
            }
        }