X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fai%2FSpawner.hpp;h=daa5f7873390b41de1d9be6db9f2f395d8b87fe3;hb=dcd54cacda98c2c0f7cf0c7a9131fb858d8ee10a;hp=c55d73c0f7f90b835b5791f69e8c9096e17cc81d;hpb=ad7cf72ed47c39640d5588ba53386e090289b4d1;p=blank.git diff --git a/src/ai/Spawner.hpp b/src/ai/Spawner.hpp index c55d73c..daa5f78 100644 --- a/src/ai/Spawner.hpp +++ b/src/ai/Spawner.hpp @@ -2,42 +2,49 @@ #define BLANK_AI_SPAWNER_HPP_ #include "../app/IntervalTimer.hpp" -#include "../model/EntityModel.hpp" +#include "../graphics/glm.hpp" #include -#include namespace blank { -class Controller; +class Entity; +class Model; +class ModelRegistry; class World; class Spawner { public: - explicit Spawner(World &); + Spawner(World &, ModelRegistry &); ~Spawner(); + void LimitModels(std::size_t begin, std::size_t end); + void Update(int dt); private: void CheckDespawn() noexcept; void TrySpawn(); - void Spawn(const glm::ivec3 &, const glm::vec3 &); + void Spawn(Entity &reference, const glm::ivec3 &, const glm::vec3 &); + + Model &RandomModel() noexcept; private: World &world; - std::vector controllers; + ModelRegistry ⊧ + std::vector entities; - EntityModel models[3]; - - IntervalTimer timer; + CoarseTimer timer; float despawn_range; float spawn_distance; unsigned int max_entities; int chunk_range; + std::size_t model_offset; + std::size_t model_length; + }; }