]> git.localhorst.tv Git - blank.git/blob - src/ai/Spawner.hpp
avoid library rand()
[blank.git] / src / ai / Spawner.hpp
1 #ifndef BLANK_AI_SPAWNER_HPP_
2 #define BLANK_AI_SPAWNER_HPP_
3
4 #include "../app/IntervalTimer.hpp"
5 #include "../model/CompositeModel.hpp"
6 #include "../model/EntityModel.hpp"
7 #include "../rand/GaloisLFSR.hpp"
8
9 #include <vector>
10 #include <glm/glm.hpp>
11
12
13 namespace blank {
14
15 class Controller;
16 class World;
17
18 class Spawner {
19
20 public:
21         Spawner(World &, std::uint64_t seed);
22         ~Spawner();
23
24         void Update(int dt);
25
26 private:
27         void CheckDespawn() noexcept;
28         void TrySpawn();
29         void Spawn(const glm::ivec3 &, const glm::vec3 &);
30
31 private:
32         World &world;
33         std::vector<Controller *> controllers;
34
35         EntityModel models[3];
36         CompositeModel skeletons[3];
37
38         GaloisLFSR random;
39
40         IntervalTimer timer;
41         float despawn_range;
42         float spawn_distance;
43         unsigned int max_entities;
44         int chunk_range;
45
46 };
47
48 }
49
50 #endif