aboutsummaryrefslogtreecommitdiff
path: root/game/prefab/ZapperPoolScript.h
diff options
context:
space:
mode:
Diffstat (limited to 'game/prefab/ZapperPoolScript.h')
-rw-r--r--game/prefab/ZapperPoolScript.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/game/prefab/ZapperPoolScript.h b/game/prefab/ZapperPoolScript.h
new file mode 100644
index 0000000..6aee8b2
--- /dev/null
+++ b/game/prefab/ZapperPoolScript.h
@@ -0,0 +1,33 @@
+#pragma once
+
+#include <crepe/api/Script.h>
+
+#include "ZapperObject.h"
+#include "util/OptionalRef.h"
+
+class ZapperPoolSubScene;
+
+class ZapperPoolScript : public crepe::Script {
+public:
+ ZapperPoolScript(std::vector<ZapperObject> && pool);
+
+ void init();
+ void fixed_update(crepe::duration_t);
+
+ unsigned i = 0;
+
+private:
+ std::vector<ZapperObject> pool;
+
+private:
+ crepe::OptionalRef<crepe::Transform> camera_transform;
+ crepe::OptionalRef<crepe::Camera> camera_camera;
+ crepe::OptionalRef<ZapperObject> get_next_zapper();
+
+private:
+ void spawn_random();
+
+private:
+ static constexpr float OFFSCREEN_MARGIN = 40;
+};
+