Ejemplo n.º 1
0
        public void BuyIngredients()
        {
            Console.WriteLine($"You have ${Inventory.Balance}");
            Console.WriteLine("Choose an item to buy from the store.");
            Console.WriteLine($"1. Store bought lemonade. Price: ${BasicRecipe.GetCost()}");
            Console.WriteLine($"2. Lemon. Price: ${Store.LemonPrice}");
            Console.WriteLine($"3. Sugar Packets. Price: ${Store.SugarPrice}");
            Console.WriteLine($"4. Ice Cubes. Price: ${Store.IcePrice}");
            Console.WriteLine($"5. Done shopping.");

            while (true)
            {
                Console.WriteLine("What would you like to buy? ");
                int userInput = Validation.ReadUserInput(5);
                switch (userInput)
                {
                case 1:
                {
                    BuyItem((count) => { Inventory.BuyBasicRecipe(count); dayLoss -= count * BasicRecipe.GetCost(); }, BasicRecipe.GetCost());
                    break;
                }

                case 2:
                {
                    BuyItem((count) => { Inventory.BuyLemon(count); dayLoss -= count * Store.LemonPrice; }, Store.LemonPrice);
                    break;
                }

                case 3:
                {
                    BuyItem((count) => { Inventory.BuySugar(count); dayLoss -= count * Store.SugarPrice; }, Store.SugarPrice);
                    break;
                }

                case 4:
                {
                    BuyItem((count) => { Inventory.BuyIce(count); dayLoss -= count * Store.IcePrice; }, Store.IcePrice);
                    break;
                }

                case 5:
                {
                    return;
                }
                }
            }
        }