]> git.localhorst.tv Git - blank.git/blob - src/ai/Spawner.hpp
composite model is the canonical model
[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
6 #include <vector>
7 #include <glm/glm.hpp>
8
9
10 namespace blank {
11
12 class Controller;
13 class Entity;
14 class GaloisLFSR;
15 class Model;
16 class Skeletons;
17 class World;
18
19 class Spawner {
20
21 public:
22         Spawner(World &, Skeletons &, GaloisLFSR &);
23         ~Spawner();
24
25         void LimitSkeletons(std::size_t begin, std::size_t end);
26
27         void Update(int dt);
28
29 private:
30         void CheckDespawn() noexcept;
31         void TrySpawn();
32         void Spawn(Entity &reference, const glm::ivec3 &, const glm::vec3 &);
33
34         Model &RandomSkeleton() noexcept;
35
36 private:
37         World &world;
38         Skeletons &skeletons;
39         std::vector<Controller *> controllers;
40
41         GaloisLFSR &random;
42
43         IntervalTimer timer;
44         float despawn_range;
45         float spawn_distance;
46         unsigned int max_entities;
47         int chunk_range;
48
49         std::size_t skeletons_offset;
50         std::size_t skeletons_length;
51
52 };
53
54 }
55
56 #endif