Repository navigation
Expand file tree
/
Copy pathGameEngine.cs
More file actions
117 lines (95 loc) · 3.31 KB
/
Copy pathGameEngine.cs
File metadata and controls
117 lines (95 loc) · 3.31 KB
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace myConsoleRPGCSharp
{
class GameEngine
{
// ATTRIBUTES
private bool isPlayingQM = true;
private bool inMainMenu = true;
private int choice = 0;
// TRAVEL
public Travel newTravel;
// PLAYER
public int currentPlayer;
public List<PlayerCharacter> characters;
// SHOP
Shop newShop;
// GETTERS & SETTERS
public bool IsPlayingQM { get { return isPlayingQM; } set { isPlayingQM = value; } }
public int CurrentPlayer { get { return currentPlayer; } set { currentPlayer = value; } }
public bool InMainMenu { get { return inMainMenu; } set { inMainMenu = value; } }
// FUNCTIONS
public void Initialize()
{
string name = "";
isPlayingQM = true;
inMainMenu = true;
newTravel = new Travel();
characters = new List<PlayerCharacter>();
characters.Add(new PlayerCharacter());
Console.WriteLine("Name: ");
name = Console.ReadLine();
currentPlayer = characters.Count - 1;
characters[currentPlayer].createNewCharacter(name);
newShop = new Shop(characters[currentPlayer]);
}
public void MainMenu()
{
newShop.Shopping = true;
Console.Clear();
Console.ForegroundColor = ConsoleColor.Cyan;
Console.WriteLine("\nMAIN MENU");
Console.ResetColor();
Console.WriteLine(
"===========\n" +
"0: Quit\n" +
"1: Character info\n" +
"2: Shop\n" +
"3: Level up\n" +
"4: Inventory\n\n" +
"5: =TRAVEL=\n" +
"Choice: ");
// PICKING CHOICE
try
{
choice = Convert.ToInt32(Console.ReadLine());
switch (choice)
{
default:
Console.WriteLine("Wrong choice");
break;
case 0:
isPlayingQM = false;
break;
case 1:
characters[currentPlayer].PrintCharacterInfo();
Console.ReadKey();
break;
case 2:
newShop.ShopMenu(characters[currentPlayer]);
break;
case 3:
characters[currentPlayer].LevelUpMenu();
break;
case 4:
characters[currentPlayer].inventory.PrintItems();
Console.WriteLine(characters[currentPlayer].inventory.NumberOfItems);
break;
case 5:
inMainMenu = false;
newTravel.IsTravellingQM = true;
newTravel.Traveling(characters[currentPlayer], this);
break;
}
}
catch
{
Console.WriteLine("Wrong input!");
}
}
}
}