-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGameManager.hpp
94 lines (81 loc) · 2.21 KB
/
GameManager.hpp
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
#ifndef GAME_MANAGER_H
#define GAME_MANAGER_H
#include "../Engine/Component.hpp"
#include "../Engine/GameObject.hpp"
#include "../Engine/Engine.hpp"
#include "../Engine/Physics.hpp"
#include "../Engine/Layers.hpp"
#include "../STDComps/UIRenderer.hpp"
#include "../Engine/PrefabManager.hpp"
#include "SafeSpace.hpp"
#include "PlayerController.hpp"
#include <vector>
#include "../STDComps/UIText.hpp"
using namespace GameEngine;
using namespace std;
// Must be added to a gameObject after the player is made
class GameManager : public Component
{
/* variables */
public:
string playerTag = "Player";
float timeBetweenStates = 30;
vector<SafeSpace*>* safeSpaces; // hold all the safeSpaces on the map
GameLayer playerLayer = GameLayer::PLAYER;
Vector2f counterPos = Vector2f(500, 0);
private:
static GameManager* instance; // make this class a singleton
GameObject* gameObject;
Engine* engine;
Physics* physics;
PrefabManager* prefabMan;
PlayerController* playerController;
float elapsedTime;
bool isSafe;
UIRenderer* viewPanel;
UIText* timeCounter;
GameObject* UITextObj;
float counter;
/* methods */
/// <summary>
/// A private constructor for this singleton class
/// </summary>
GameManager();
public:
/// <summary>
/// Gets the instance of this singleton class
/// </summary>
/// <returns>The instance of this signleton class</returns>
static GameManager* getInstance()
{
if (instance == NULL)
{
instance = new GameManager();
}
return instance;
}
/// <summary>
/// Add a gameObject to this component.
/// MUST HAPPEN AFTER THE PLAYER GAME OBJECT IS MADE
/// </summary>
/// <param name="gameObject">the gameObject that his component is attached to</param>
void addGameObject(GameObject* gameObject);
/// <summary>
/// A destructor for a GameManager object
/// </summary>
~GameManager();
/// <summary>
/// called every frame by the GameObject that has this component
/// </summary>
void update();
/// <summary>
/// Called every frame after update. Used to handle physics and collisions
/// </summary>
void lateUpdate();
/// <summary>
/// Reset this component to the status it would be at when a scene is
/// first loaded
/// </summary>
void resetComponent();
};
#endif // !GAME_MANAGER_H