예제 #1
0
        public void RunDay(Player player, Weather weather)
        {
            UI.DisplayActualWeatherForToday(weather);
            UI.DisplayPlayerInventory(player);

            while (UI.DoesUserWantTo("buy anything from the store"))
            {
                Store.DisplayItemsForSale();
                Store.ProcessOrder(player);
                UI.DisplayPlayerInventory(player);
            }

            player.recipe.DisplayRecipe();

            while (UI.DoesUserWantTo("change the recipe"))
            {
                player.ChangeRecipe();
                player.recipe.DisplayRecipe();
            }

            int cupsSold = 0;

            if (player.RanOutOfInventoryItems())
            {
                return;
            }
            player.MakePitcherOfLemonade();
            List <Customer> buyingCustomers = GenerateCustomerList(weather, player.recipe);

            foreach (Customer buyingCustomer in buyingCustomers)
            {
                if (buyingCustomer.isBuying == true)
                {
                    if (player.RanOutOfInventoryItems())
                    {
                        break;
                    }
                    cupsSold++;
                    player.AdjustInventoryAfterSale(cupsSold);
                }
            }
        }