-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHeadQuarters.hpp
More file actions
69 lines (58 loc) · 1.46 KB
/
HeadQuarters.hpp
File metadata and controls
69 lines (58 loc) · 1.46 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
/*****************************************************************************/
/*!
\file HeadQuarters.hpp
\author Yeongki Baek
\par email: yeongki.baek\@digipen.edu
\date 08/01/2017
\brief
This is the interface file for the module
Copyright 2017, Digipen Institute of Technology
*/
/*****************************************************************************/
#pragma once
namespace HOLD
{
class Message;
class Command;
class StateManager;
typedef std::unordered_map<size_t, Command*> CommandUMap;
class HeadQuarters
{
public:
~HeadQuarters();
void Initialize();
void Run() const;
void Shutdown() const;
void BroadcastMessage(Message* message) const;
void SetActive(bool active) { m_Active = active; }
static HeadQuarters* GetInstance();
template<typename T>
T* GetCommand() const
{
return static_cast<T*>((*m_CommandList.find(typeid(T).hash_code())).second);
}
template<typename T>
void AttachCommander(T* system)
{
//todo : assert if it's already existed
m_CommandList[typeid(T).hash_code()] = system;
}
template<typename T>
void DetachCommander(T* system)
{
m_CommandList.erase(typeid(T).hash_code());
}
void Init();
void OnUnitMorph(Unit unit);
unsigned long frame_count = 0;
double last_time, current_time;
private:
CommandUMap m_CommandList;
StateManager* m_StateManager;
bool m_Active;
float m_CurrentTime;
//singleton
static HeadQuarters* m_Instance;
HeadQuarters();
};
} //namespace HOLD