예제 #1
0
        public void RunDay(Player player, Random random, Weather weather)
        {
            // Randomly adjust weather based upon forecasted weather
            RandomlyAdjustWeather(weather, random);

            // Display today's weather
            UserInterface.DisplayWeather(weather.temperature, weather.condition);
            UserInterface.ClearDisplay();

            player.recipe.SetRecipe();
            UserInterface.ClearDisplay();
            if (CheckStockIngredients(player) == false)
            {
                return;
            }
            player.pitcher.FillPitcher(player.recipe, player);

            amountOfPeople = random.Next(5, 20);

            // Run through however many people come to the stand that day
            for (int i = 0; i < amountOfPeople; i++)
            {
                customers.Add(new Customer(random, weather, player.recipe));

                CheckStockCups(player);

                if (customers[i].wantsLemonade == true && player.pitcher.cupsInPitcher > 0)
                {
                    player.pitcher.PourAGlass(player);
                    player.wallet.Money += player.recipe.pricePerGlass;
                }
                else if (customers[i].wantsLemonade == true && player.pitcher.cupsInPitcher <= 0)
                {
                    if (CheckStockIngredients(player) == false)
                    {
                        return;
                    }
                    UserInterface.AlertToNewPitcher();
                    player.pitcher.FillPitcher(player.recipe, player);
                    player.pitcher.PourAGlass(player);
                    player.wallet.Money += player.recipe.pricePerGlass;
                }

                UserInterface.CustomerStopsByShop(customers[i].name, customers[i].wantsLemonade);
                UserInterface.ClearDisplay();
            }

            EndOfDayResponsibilities(player);
        }