-
Notifications
You must be signed in to change notification settings - Fork 0
/
Game.cs
161 lines (142 loc) · 4.92 KB
/
Game.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LemonadeStand
{
public class Game
{
//has a
public List<Day> daysPlayed;
public Store store;
public Player player;
public int i;
public Random randoCalrissian;
public Customer customer;
public Pitcher pitcher;
public Game game;
public List<double> noOfCustomersBought;
// public Day day;
//spawner
public Game()
{
randoCalrissian = new Random();
i = 0;
daysPlayed = new List<Day>();
player = new Player();
store = new Store();
RunGame(noOfCustomersBought);
}
//can do
public void RunGame(List<double> noOfCustomersBought)
{
Start();
GetDays();
while (i <= daysPlayed.Count - 1)
{
Console.WriteLine("day " + (i + 1));
player.inventory.DisplayCurrentInventory();
Console.WriteLine("Do you want to go to store?");
string shop = Console.ReadLine().ToLower();
switch (shop)
{
case "yes":
{
Console.Clear();
store.DisplayPrices();
store.Shopping(player);
break;
}
case "no":
{
break;
}
}
daysPlayed[i].weather.DisplayWeather();
player.inventory.DisplayCurrentInventory();
player.recipe.DisplayCurrentRecipe();
Console.WriteLine("Would you like to change the current recipe");
string recipechange = Console.ReadLine().ToLower();
switch (recipechange)
{
case "yes":
player.ChooseLemons();
player.ChooseSugar();
player.ChooseIce();
player.PriceofLemonade();
break;
case "no":
break;
}
pitcher = new Pitcher(player, player.recipe, daysPlayed, noOfCustomersBought);
if (pitcher.cupsToPitcher == 10)
{
DisplayCustomers();
daysPlayed[i].SellLemonade(player, pitcher);
daysPlayed[i].EndDay(noOfCustomersBought);
i++;
Console.Clear();
}
else if(pitcher.cupsToPitcher == 0)
{
pitcher.InventoryCheck(player, daysPlayed, noOfCustomersBought);
pitcher = new Pitcher(player, player.recipe, daysPlayed, noOfCustomersBought);
daysPlayed[i].EndDay(noOfCustomersBought);
i++;
Console.Clear();
}
}
}
void Start()
{
Console.WriteLine("Welcome to LemonadeStand");
Console.ReadKey();
Console.Clear();
}
void GetDays()
{
Console.WriteLine("Please Choose the Number of Days You would Like To Play (7, 14, or 30)");
string noOfDays;
noOfDays = Console.ReadLine();
switch (noOfDays)
{
case "7":
while (daysPlayed.Count < 7)
{
Day day1 = new Day(randoCalrissian);
daysPlayed.Add(day1);
}
break;
case "14":
while (daysPlayed.Count < 14)
{
Day day1 = new Day(randoCalrissian);
daysPlayed.Add(day1);
}
break;
case "30":
while (daysPlayed.Count < 30)
{
Day day1 = new Day(randoCalrissian);
daysPlayed.Add(day1);
}
break;
default:
Console.WriteLine("You Must Choose Either 7,14, or 30");
Console.ReadKey();
Console.Clear();
GetDays();
break;
}
Console.WriteLine("You are playing for " + daysPlayed.Count + " days");
Console.ReadKey();
Console.Clear();
}
void DisplayCustomers()
{
Console.WriteLine("Number of customers Today " + daysPlayed[i].customer.AmountOfCustomers.Count);
Console.ReadKey();
}
}
}