aboutsummaryrefslogtreecommitdiff
path: root/game/prefab/ZapperPoolScript.h
blob: 2208c80ff373bd048d65f7dd3bfae9ce111b7265 (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
26
27
28
29
30
31
32
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 MAX_LENGTH = 400;
	static constexpr float OFFSCREEN_MARGIN = 50 + MAX_LENGTH;
};