-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathProgram.cs
More file actions
64 lines (55 loc) · 1.43 KB
/
Program.cs
File metadata and controls
64 lines (55 loc) · 1.43 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
using System;
using _15TextRPG.Source;
using _15TextRPG.Source.Combat;
using _15TextRPG.Source.State;
namespace _15TextRPG
{
class TextRPG
{
private static void Main()
{
Console.SetWindowSize(150, 50);
GameManager.Instance.Run();
}
}
public class GameManager
{
private static GameManager instance;
public static GameManager Instance
{
get
{
if (instance == null)
instance = new GameManager();
return instance;
}
}
private IGameState currentState;
private bool isRunning = true;
public GameData GameData { get; private set; }
public BattleManager BattleManager { get; private set; }
private GameManager()
{
GameData = new GameData();
currentState = new TitleMenuState();
BattleManager = new BattleManager();
}
public void Run()
{
while (isRunning)
{
currentState.DisplayMenu();
currentState.HandleInput();
}
}
public void ChangeState(IGameState newState)
{
currentState = newState;
}
public void QuitGame()
{
Console.WriteLine("게임을 종료합니다.");
isRunning = false;
}
}
}