Singleton managing enemy and key spawning. Spawns a single enemy at an interval, selecting drone or car based on which is required or taking turns if both. Spawns three keys at the start of the game.
More...
#include <spawner.hpp>
|
virtual void | _enter_tree () override |
| Spawn three keys. Store gamemode reference.
|
|
virtual void | _process (double delta_time) override |
| Update timer, spawn new enemy as required.
|
|
int | max_enemy_cars () |
| The max number of cars, increases with number of keys found.
|
|
int | max_enemy_drones () |
| The max number of drones, increases with number of enemies found.
|
|
|
void | spawn_enemy_car () |
| Spawn an enemy car at a random spawnpoint. Increases car counter.
|
|
void | spawn_enemy_drone () |
| Spawn an enemy drone at a random spawnpoint. Increases drone counter.
|
|
void | spawn_key () |
| Spawn a key at a random spawnpoint.
|
|
void | decrement_cars () |
| Listener for when a car is destroyed somehow. Decreases car counter.
|
|
void | decrement_drones () |
| Listener for when a drone is destroyed somehow. Decreases drone counter.
|
|
void | set_drone_scene (Ref< PackedScene > scene) |
| The scene to instantiate for drones.
|
|
Ref< PackedScene > | get_drone_scene () const |
| The scene to instantiate for drones.
|
|
void | set_car_scene (Ref< PackedScene > scene) |
| The scene to instantiate for cars.
|
|
Ref< PackedScene > | get_car_scene () const |
| The scene to instantiate for cars.
|
|
void | set_key_scene (Ref< PackedScene > scene) |
| The scene to instantiate for keys.
|
|
Ref< PackedScene > | get_key_scene () const |
| The scene to instantiate for keys.
|
|
Singleton managing enemy and key spawning. Spawns a single enemy at an interval, selecting drone or car based on which is required or taking turns if both. Spawns three keys at the start of the game.
◆ _bind_methods()
void godot::Spawner::_bind_methods |
( |
| ) |
|
|
staticprivate |
Register editor properties.
◆ _enter_tree()
void godot::Spawner::_enter_tree |
( |
| ) |
|
|
overridevirtual |
Spawn three keys. Store gamemode reference.
◆ _process()
void godot::Spawner::_process |
( |
double |
delta_time | ) |
|
|
overridevirtual |
Update timer, spawn new enemy as required.
◆ decrement_cars()
void godot::Spawner::decrement_cars |
( |
| ) |
|
|
protected |
Listener for when a car is destroyed somehow. Decreases car counter.
◆ decrement_drones()
void godot::Spawner::decrement_drones |
( |
| ) |
|
|
protected |
Listener for when a drone is destroyed somehow. Decreases drone counter.
◆ GDCLASS()
godot::Spawner::GDCLASS |
( |
Spawner |
, |
|
|
Node |
|
|
) |
| |
|
private |
◆ get_car_scene()
Ref< PackedScene > godot::Spawner::get_car_scene |
( |
| ) |
const |
|
protected |
The scene to instantiate for cars.
◆ get_drone_scene()
Ref< PackedScene > godot::Spawner::get_drone_scene |
( |
| ) |
const |
|
protected |
The scene to instantiate for drones.
◆ get_key_scene()
Ref< PackedScene > godot::Spawner::get_key_scene |
( |
| ) |
const |
|
protected |
The scene to instantiate for keys.
◆ max_enemy_cars()
int godot::Spawner::max_enemy_cars |
( |
| ) |
|
The max number of cars, increases with number of keys found.
◆ max_enemy_drones()
int godot::Spawner::max_enemy_drones |
( |
| ) |
|
The max number of drones, increases with number of enemies found.
◆ set_car_scene()
void godot::Spawner::set_car_scene |
( |
Ref< PackedScene > |
scene | ) |
|
|
protected |
The scene to instantiate for cars.
◆ set_drone_scene()
void godot::Spawner::set_drone_scene |
( |
Ref< PackedScene > |
scene | ) |
|
|
protected |
The scene to instantiate for drones.
◆ set_key_scene()
void godot::Spawner::set_key_scene |
( |
Ref< PackedScene > |
scene | ) |
|
|
protected |
The scene to instantiate for keys.
◆ spawn_enemy_car()
void godot::Spawner::spawn_enemy_car |
( |
| ) |
|
|
protected |
Spawn an enemy car at a random spawnpoint. Increases car counter.
◆ spawn_enemy_drone()
void godot::Spawner::spawn_enemy_drone |
( |
| ) |
|
|
protected |
Spawn an enemy drone at a random spawnpoint. Increases drone counter.
◆ spawn_key()
void godot::Spawner::spawn_key |
( |
| ) |
|
|
protected |
Spawn a key at a random spawnpoint.
◆ car_scene
Ref<PackedScene> godot::Spawner::car_scene {} |
|
private |
◆ drone_scene
Ref<PackedScene> godot::Spawner::drone_scene {} |
|
private |
◆ game_mode
Reference to the game mode.
◆ key_scene
Ref<PackedScene> godot::Spawner::key_scene {} |
|
private |
◆ next
double godot::Spawner::next {0} |
|
private |
Time at which the next spawn tick will go.
◆ num_cars
unsigned godot::Spawner::num_cars {0} |
|
private |
◆ num_drones
unsigned godot::Spawner::num_drones {0} |
|
private |
◆ rng
RandomNumberGenerator godot::Spawner::rng {} |
|
private |
◆ tick
unsigned godot::Spawner::tick {0} |
|
private |
The number of spawn ticks that have happened, could overflow, though that's not a problem.
The documentation for this class was generated from the following files: