-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEntityManager.h
52 lines (38 loc) · 891 Bytes
/
EntityManager.h
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
#pragma once
#include <queue>
#include <vector>
#include "Entity.h"
namespace tmpl8
{
class vec2;
}
class EntityManager
{
public:
EntityManager(std::vector<Entity*>& entities)
: active(entities)
{}
~EntityManager()
{
while (!inactive.empty())
{
delete inactive.front();
inactive.pop();
}
}
EntityManager(EntityManager&) = delete;
EntityManager(EntityManager&&) = delete;
EntityManager& operator=(EntityManager&) = delete;
EntityManager& operator=(EntityManager&&) = delete;
void Update();
void Deactivate(Entity& e);
void Activate(tmpl8::vec2 pos);
void SetActive(bool state) { isActive = state; }
void SetDifficulty(int difficulty) { this->difficulty = difficulty; }
private:
std::vector<Entity*>& active;
std::queue<Entity*> inactive;
float spawn_timer = 1.0f;
bool isActive = false;
int difficulty = 1;
};