blob: d7d30ea555b1956fca3c1cfa1ff80bbd9e3ff8be (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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") } {
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 {};
}
|