Exemple #1
0
        public void PlayGame()
        {
            int currentDay = 1;
            int menuOption;
            int amountOfDays;

            player.name  = UserInterface.GetUsersName();
            amountOfDays = UserInterface.GetNumberOfDays();
            days         = new List <Day>()
            {
                new Day(random)
            };
            UserInterface.DisplayWelcome(player);
            player.recipe.CreateRecipe();
            UserInterface.DisplayRecipe(player.recipe);

            for (int i = 0; i < amountOfDays; i++)
            {
                wouldYouLikeToContinue             = "Y";
                player.pitcher.pitchersOfLemonade /= 2;
                player.pitcher.cupsOfLemonade      = player.pitcher.pitchersOfLemonade * player.pitcher.cupsPerPitcher;
                while (wouldYouLikeToContinue.ToLower() == "y")
                {
                    if (player.wallet.Money > 0 || (player.inventory.lemons.Count > 0 && player.inventory.iceCubes.Count > 0 && player.inventory.sugarCubes.Count > 0 && player.inventory.cups.Count > 0)) //If player money > 0 OR the item in inventory > 0
                    {
                        Console.Clear();
                        UserInterface.DisplayCurrentDay(currentDay);
                        UserInterface.GetWeatherConditions(days[currentDay - 1]);
                        UserInterface.DisplayWallet(player.wallet);
                        UserInterface.DisplayCupsOfLemonade(player);
                        menuOption = UserInterface.BuySellInvRecipeOption();
                        MenuSelection(menuOption, currentDay);
                    }
                    else if (player.wallet.Money <= 0 && (player.inventory.lemons.Count == 0 || player.inventory.iceCubes.Count == 0 || player.inventory.sugarCubes.Count == 0 || player.inventory.cups.Count == 0))// if player money <= 0 AND and a item in inventory = 0
                    {
                        UserInterface.DisplayMoneyMessage(currentDay);
                        return;
                    }
                    else if (player.wallet.Money <= 0 && (player.inventory.lemons.Count == 0 && player.inventory.iceCubes.Count == 0 && player.inventory.sugarCubes.Count == 0 && player.inventory.cups.Count == 0)) // If money <Ju= 0 AND all items in inventory = 0
                    {
                        UserInterface.DisplayMoneyInvMessage(currentDay);
                    }
                }
                days.Add(new Day(random));
                currentDay++;
            }
            UserInterface.DisplayEndGameMessage(currentDay, player);
        }