コード例 #1
0
ファイル: Recipe.cs プロジェクト: cyang24/Lemonade-Stand
        public void UsedTotalAfterOneDay(Player player, Inventory inventory, Day_Weather day_Weather)
        {
            if (player.recipe.cupsToUse > day_Weather.thirstyCustomers.Count)
            {
                for (int i = 0; i < day_Weather.totalBought; i++)
                {
                    inventory.cupsInventory.RemoveAt(0);
                }
            }
            else if (cupsToUse < day_Weather.thirstyCustomers.Count)
            {
                for (int i = 0; i < player.recipe.cupsToUse; i++)
                {
                    inventory.cupsInventory.RemoveAt(0);
                }
            }

            //for Lemons
            if (player.recipe.cupsToUse > day_Weather.thirstyCustomers.Count)
            {
                for (int i = 0; i < player.recipe.lemonsToUse; i++)
                {
                    inventory.lemonsInventory.RemoveAt(0);
                }
            }

            else if (player.recipe.cupsToUse < day_Weather.thirstyCustomers.Count)
            {
                for (int i = 0; i < player.recipe.lemonsToUse; i++)
                {
                    inventory.lemonsInventory.RemoveAt(0);
                }
            }

            //for Sugar
            if (player.recipe.cupsToUse > day_Weather.thirstyCustomers.Count)
            {
                for (int i = 0; i < player.recipe.sugarToUse; i++)
                {
                    inventory.sugarInventory.RemoveAt(0);
                }
            }

            else if (player.recipe.cupsToUse < day_Weather.thirstyCustomers.Count)
            {
                for (int i = 0; i < player.recipe.sugarToUse; i++)
                {
                    inventory.sugarInventory.RemoveAt(0);
                }
            }

            //for Ice

            inventory.iceInventory.Clear();
            Console.WriteLine("All your ice melted");
        }
コード例 #2
0
ファイル: Game.cs プロジェクト: cyang24/Lemonade-Stand
        public void GameLoopSevenDays(UserInterface userInterface, Store store, Inventory inventory, Recipe recipe)
        {
            do
            {
                Day_Weather day_Weather = new Day_Weather();
                player.SetLemonadePrice();
                day_Weather.DailyCustomerResults(player, inventory, recipe, day_Weather);
                userInterface.DisplayInventory(inventory);
                userInterface.CheckBalanceCheckInventoryGoToStore(player, inventory, store);
                currentDay += 1;
                Console.WriteLine("It's Day " + currentDay);
            }while (currentDay < 8);

            if (player.wallet.PlayerMoney < 0)
            {
                Console.WriteLine("Ouch! Looks like you didn't make any money.");
            }
            else
            {
                Console.WriteLine("After 7 Days You Made $" + (player.wallet.PlayerMoney - Convert.ToDecimal(20)));
            }

            PlayAgain();
        }
コード例 #3
0
ファイル: Day&Weather.cs プロジェクト: cyang24/Lemonade-Stand
 public void DailyCustomerResults(Player player, Inventory inventory, Recipe recipe, Day_Weather day_Weather)
 {
     customer         = new Customer();
     thirstyCustomers = new List <Customer>();
     GenerateCustomerConditions(); // creates number of customers
     Console.WriteLine("You have " + thirstyCustomers.Count + " potential customers today!");
     ChanceBasedOnWeather();       // creates weather condition chances
     ChanceBasedOnPrice(player);   // creates price chances
     ChanceBasedOnTemperature();   // creates temperature chances
     CustomersWillBuy(player);
     CupsSold(player);
     DailyTotalResults(player);
     player.recipe.UsedTotalAfterOneDay(player, inventory, day_Weather);
     ResetCustomers(); //resets customer count
 }