public void BuyCup(Player player, Pitcher pitcher, Inventory inventory) { player.cash += player.GetPrice(); pitcher.AdjustFull(-10); inventory.RemoveCup(); cashMakeFromSale += player.GetPrice(); Console.ForegroundColor = ConsoleColor.DarkCyan; Console.WriteLine("Yay! A customer just bought a cup of lemonade"); Console.ResetColor(); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("You made ${0} and your pitcher of lemonade is {1}% left.\n", player.GetPrice(), pitcher.GetFull()); Console.ResetColor(); }
public void StartDay(Inventory inventory, Player player, Game game, Weather weather) { Console.WriteLine("You start day {0}.", game.GetCurrentDay()); bool dayNotOver = true; bool outOfLemonade = false; bool outOfCups = false; int timePeriod = 1; Pitcher pitcher = new Pitcher(player); dailyIncome = 0; if (dayRandom.Next(0, 100) <= weather.GetRain()) { isRaining = true; Console.WriteLine("It is raining."); } else { isRaining = false; } if (CheckRecipe(inventory, player)) { pitcher.FillPitcher(inventory, player); } else { Console.WriteLine("You can't sell any lemonade today."); outOfLemonade = true; dayNotOver = false; } if (inventory.GetCups() < 1) { Console.WriteLine("You're out of cups! You can't sell any lemonade today."); dayNotOver = false; } while (timePeriod <= numberOfTimePeriods && dayNotOver) { if (pitcher.GetFull() <= 0) { if (CheckRecipe(inventory, player)) { pitcher.FillPitcher(inventory, player); } else { Console.WriteLine("You can't sell any more lemonade today."); outOfLemonade = true; dayNotOver = false; } } if (inventory.GetCups() < 1) { outOfCups = true; Console.WriteLine("You've run out of cups. You can't sell any more lemonade today."); dayNotOver = false; } if (!outOfLemonade && !outOfCups) { Thread.Sleep(2000); DisplayTime(timePeriod); if (dayRandom.Next(0, 100) <= weather.GetRain()) { isRaining = true; Console.WriteLine("It is raining."); } else { if (isRaining) { Console.WriteLine("It has stopped raining."); } isRaining = false; } CheckForCustomer(player, pitcher, inventory, weather); } timePeriod++; } Console.WriteLine("Day {0} is complete.", game.GetCurrentDay()); Console.WriteLine("You spent {0} today.", player.GetMoneySpentToday()); Console.WriteLine("You had a total income of {0}.", dailyIncome); if (dailyIncome - player.GetMoneySpentToday() >= 0) { Console.WriteLine("Your profit today was {0}.", dailyIncome - player.GetMoneySpentToday()); } else { Console.WriteLine("Your loss today was {0}.", dailyIncome - player.GetMoneySpentToday()); } player.totalMoneyEarned += dailyIncome; Console.WriteLine("You have spent {0} total.", player.totalMoneySpent); Console.WriteLine("You have total income of {0}.", player.totalMoneyEarned); if (player.totalMoneyEarned - player.totalMoneySpent >= 0) { Console.WriteLine("Your total profit is {0}.", player.totalMoneyEarned - player.totalMoneySpent); } else { Console.WriteLine("Your total loss is {0}.", player.totalMoneyEarned - player.totalMoneySpent); } }
public void StartDay(Inventory inventory, Player player, Game game, Weather weather) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("!!~~~~Lemonade Bussiness in Progress~~~!!\n"); Console.ResetColor(); Console.ReadKey(); bool businessIsInProcess = true; bool pitcherIsEmpty = false; bool CupIsOut = false; int timePeriod = 1; Pitcher pitcher = new Pitcher(player); cashMakeFromSale = 0; if (CheckRecipe(inventory, player) == true) { pitcher.Fill(inventory, player); } else { Console.WriteLine("You're missing some supplies!"); Console.WriteLine("Please double check your inventory and recipe"); pitcherIsEmpty = true; businessIsInProcess = false; } while (timePeriod <= numberOfTimePeriods && businessIsInProcess) { if (pitcher.GetFull() <= 10) { Console.WriteLine("You ran out of Lemonade juice!"); Console.WriteLine("Do you want to check if you have enough supplies to make another pitcher?"); string makeAnotherPitcher = Console.ReadLine().ToLower(); if (makeAnotherPitcher == "yes" || makeAnotherPitcher == "y") { if (CheckRecipe(inventory, player) && businessIsInProcess == true) { pitcher.Fill(inventory, player); } else { Console.WriteLine("\nSorry but you don't have enough supplies to make another Pitcher"); } } else if (makeAnotherPitcher == "no" || makeAnotherPitcher == "n") { Console.WriteLine("\n****Today Result****"); Console.WriteLine("press any key to see today result"); Console.ReadKey(); break; } else { try { if (makeAnotherPitcher.Equals("")) { Console.WriteLine("Please choose a valid option"); } } catch { Console.WriteLine("Please choose a valid option"); } } } if (inventory.RetrieveCup() <= 0) { CupIsOut = true; Console.WriteLine("\nOops! seem like you run out of cups. No more business for today."); businessIsInProcess = false; } if (!pitcherIsEmpty && !CupIsOut) { DisplayTime(timePeriod); if (dayRandom.Next(0, 100) <= weather.GetRain()) { isRaining = true; Console.WriteLine("Its Raining"); } else { if (isRaining) { Console.WriteLine("The rain have stop!"); } isRaining = false; } } try { if (inventory.cupStorage.Count() >= 1) { CheckForCustomer(player, pitcher, inventory, weather); } } catch { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("\nThat was the last lemonade cup on the table!"); Console.ResetColor(); Console.WriteLine("\n~~~*Checking inventory for more cups*~~~"); Console.WriteLine("press any key to see if you have more cup\n"); Console.ReadKey(); } timePeriod++; } EndDayResult(game, player); }
public void BuyCup(Player player, Pitcher pitcher, Inventory inventory) { player.cash += player.GetPrice(); pitcher.AdjustFull(-10); inventory.UseCup(); dailyIncome += player.GetPrice(); Console.WriteLine("You made ${0} and your pitcher is {1}% full.", player.GetPrice(), pitcher.GetFull()); Console.WriteLine("Current money: ${0}. Current number of cups: {1}\n", player.GetCash(), inventory.GetCups()); }