diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2025-01-07 14:33:07 +0100 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2025-01-07 14:33:07 +0100 |
commit | 5d798c30af7026099344a068e91e1684018b4386 (patch) | |
tree | 923b54a2745c338478246b8707c6ce8361822fc7 /game/prefab/ZapperPoolSubScene.cpp | |
parent | 6d69c8ef6b663bd6716b441cc7d01164c7e33dfc (diff) | |
parent | 42cbef630ccaf3e841459d364edade1a3c72a525 (diff) |
merge + more WIP
Diffstat (limited to 'game/prefab/ZapperPoolSubScene.cpp')
-rw-r--r-- | game/prefab/ZapperPoolSubScene.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/game/prefab/ZapperPoolSubScene.cpp b/game/prefab/ZapperPoolSubScene.cpp index 578688a..d7d30ea 100644 --- a/game/prefab/ZapperPoolSubScene.cpp +++ b/game/prefab/ZapperPoolSubScene.cpp @@ -1,13 +1,25 @@ +#include <crepe/api/BehaviorScript.h> + #include "ZapperPoolSubScene.h" +#include "ZapperPoolScript.h" using namespace crepe; using namespace std; ZapperPoolSubScene::ZapperPoolSubScene(Scene & scene) : controller { scene.new_object("controller") } { - for (size_t i = 0; i < this->POOL_SIZE; i++) - zappers.emplace_back(scene.new_object("zapper")); + this->controller.add_component<BehaviorScript>().set_script<ZapperPoolScript>(*this); + + Log::logf(Log::DEBUG, "Building zapper pool..."); + for (size_t i = 0; i < this->POOL_SIZE; i++) + zappers.emplace_back(scene.new_object("zapper")); +} - +OptionalRef<ZapperObject> ZapperPoolSubScene::get_next_zapper() { + for (ZapperObject & zapper : this->zappers) { + if (!zapper.active) continue; + return zapper; + } + return {}; } |