X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fai%2FSpawner.hpp;h=daa5f7873390b41de1d9be6db9f2f395d8b87fe3;hb=5c44bcd4519e992219908316d453dac7dfef2d47;hp=e3e8f24feea0326322266596576cf9d0e8e770dc;hpb=79bff420037f150bd6efd2eef08bd06afafeb068;p=blank.git diff --git a/src/ai/Spawner.hpp b/src/ai/Spawner.hpp index e3e8f24..daa5f78 100644 --- a/src/ai/Spawner.hpp +++ b/src/ai/Spawner.hpp @@ -1,29 +1,49 @@ #ifndef BLANK_AI_SPAWNER_HPP_ #define BLANK_AI_SPAWNER_HPP_ -#include -#include +#include "../app/IntervalTimer.hpp" +#include "../graphics/glm.hpp" + +#include namespace blank { -class RandomWalk; +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 Spawn(const glm::vec3 &); + void CheckDespawn() noexcept; + void TrySpawn(); + void Spawn(Entity &reference, const glm::ivec3 &, const glm::vec3 &); + + Model &RandomModel() noexcept; private: World &world; - std::list controllers; + ModelRegistry ⊧ + std::vector entities; + + 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; };