X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fai%2FSpawner.cpp;fp=src%2Fai%2FSpawner.cpp;h=064857cd6b51e9c53df88b1957d3a612bd9af9d3;hb=a26ca06878d45d3ce77cbc28b574f2553e121944;hp=b14271ff5df846b588a56efd308b36965f87f13e;hpb=bc2806164f55b7ac48dbb6d224b7d4b55683decf;p=blank.git diff --git a/src/ai/Spawner.cpp b/src/ai/Spawner.cpp index b14271f..064857c 100644 --- a/src/ai/Spawner.cpp +++ b/src/ai/Spawner.cpp @@ -2,6 +2,7 @@ #include "Chaser.hpp" #include "RandomWalk.hpp" +#include "../app/TextureIndex.hpp" #include "../model/Model.hpp" #include "../model/Skeletons.hpp" #include "../rand/GaloisLFSR.hpp" @@ -29,7 +30,8 @@ Spawner::Spawner(World &world, Skeletons &skeletons, GaloisLFSR &rand) , max_entities(16) , chunk_range(4) , skeletons_offset(0) -, skeletons_length(skeletons.size()) { +, skeletons_length(skeletons.size()) +, tex_map() { timer.Start(); } @@ -49,6 +51,12 @@ void Spawner::LimitSkeletons(size_t begin, size_t end) { } } +void Spawner::LoadTextures(TextureIndex &tex_index) { + tex_map.clear(); + tex_map.push_back(tex_index.GetID("rock-1")); + tex_map.push_back(tex_index.GetID("rock-face")); +} + void Spawner::Update(int dt) { CheckDespawn(); timer.Update(dt); @@ -135,6 +143,7 @@ void Spawner::Spawn(Entity &reference, const glm::ivec3 &chunk, const glm::vec3 e.Bounds({ { -0.5f, -0.5f, -0.5f }, { 0.5f, 0.5f, 0.5f } }); e.WorldCollidable(true); RandomSkeleton().Instantiate(e.GetModel()); + e.GetModel().SetTextures(tex_map); e.AngularVelocity(rot); Controller *ctrl; if (random()) {