# Rally Rush: src/spawner.hpp Source File

Loading...
Searching...
No Matches
spawner.hpp
Go to the documentation of this file.
#ifndef SPAWNER_HPP
#define SPAWNER_HPP
#include "enemy_spawnpoint.hpp"
#include "godot_cpp/classes/packed_scene.hpp"
#include "godot_cpp/classes/random_number_generator.hpp"
#include "godot_cpp/templates/vector.hpp"
#include "rally_rush_game_mode.hpp"
#include <godot_cpp/classes/node.hpp>
namespace godot {
class EnemySpawnpoint;
class Spawner : public Node {
GDCLASS(Spawner, Node);
static void _bind_methods();
public:
virtual void _enter_tree() override;
virtual void _process(double delta_time) override;
int max_enemy_cars();
int max_enemy_drones();
protected:
void spawn_enemy_car();
void spawn_enemy_drone();
void spawn_key();
void decrement_cars();
void decrement_drones();
void set_drone_scene(Ref<PackedScene> scene);
Ref<PackedScene> get_drone_scene() const;
void set_car_scene(Ref<PackedScene> scene);
Ref<PackedScene> get_car_scene() const;
void set_key_scene(Ref<PackedScene> scene);
Ref<PackedScene> get_key_scene() const;
private:
double next{0};
unsigned tick{0};
Ref<PackedScene> drone_scene{};
Ref<PackedScene> car_scene{};
Ref<PackedScene> key_scene{};
RandomNumberGenerator rng{};
unsigned num_cars{0};
unsigned num_drones{0};
RallyRushGameMode *game_mode;
};
}
#endif // !SPAWNER_HPP
godot::RallyRushGameMode
Game mode for Rally Rush. Mainly serves as a scorekeeper and patchbay for Observers....
Definition rally_rush_game_mode.hpp:8
godot::Spawner
Singleton managing enemy and key spawning. Spawns a single enemy at an interval, selecting drone or c...
Definition spawner.hpp:14
godot::Spawner::get_key_scene
Ref< PackedScene > get_key_scene() const
The scene to instantiate for keys.
Definition spawner.cpp:123
godot::Spawner::drone_scene
Ref< PackedScene > drone_scene
Definition spawner.hpp:56
godot::Spawner::game_mode
RallyRushGameMode * game_mode
Reference to the game mode.
Definition spawner.hpp:64
godot::Spawner::spawn_key
void spawn_key()
Spawn a key at a random spawnpoint.
Definition spawner.cpp:79
godot::Spawner::max_enemy_cars
int max_enemy_cars()
The max number of cars, increases with number of keys found.
Definition spawner.cpp:33
godot::Spawner::GDCLASS
GDCLASS(Spawner, Node)
godot::Spawner::set_car_scene
void set_car_scene(Ref< PackedScene > scene)
The scene to instantiate for cars.
Definition spawner.cpp:111
godot::Spawner::_enter_tree
virtual void _enter_tree() override
Spawn three keys. Store gamemode reference.
Definition spawner.cpp:16
godot::Spawner::max_enemy_drones
int max_enemy_drones()
The max number of drones, increases with number of enemies found.
Definition spawner.cpp:37
godot::Spawner::num_cars
unsigned num_cars
Definition spawner.hpp:60
godot::Spawner::spawn_enemy_car
void spawn_enemy_car()
Spawn an enemy car at a random spawnpoint. Increases car counter.
Definition spawner.cpp:41
godot::Spawner::rng
RandomNumberGenerator rng
Definition spawner.hpp:59
godot::Spawner::_process
virtual void _process(double delta_time) override
Update timer, spawn new enemy as required.
Definition spawner.cpp:24
godot::Spawner::set_key_scene
void set_key_scene(Ref< PackedScene > scene)
The scene to instantiate for keys.
Definition spawner.cpp:119
godot::Spawner::decrement_drones
void decrement_drones()
Listener for when a drone is destroyed somehow. Decreases drone counter.
Definition spawner.cpp:99
godot::Spawner::set_drone_scene
void set_drone_scene(Ref< PackedScene > scene)
The scene to instantiate for drones.
Definition spawner.cpp:103
godot::Spawner::num_drones
unsigned num_drones
Definition spawner.hpp:61
godot::Spawner::key_scene
Ref< PackedScene > key_scene
Definition spawner.hpp:58
godot::Spawner::get_car_scene
Ref< PackedScene > get_car_scene() const
The scene to instantiate for cars.
Definition spawner.cpp:115
godot::Spawner::spawn_enemy_drone
void spawn_enemy_drone()
Spawn an enemy drone at a random spawnpoint. Increases drone counter.
Definition spawner.cpp:60
godot::Spawner::_bind_methods
static void _bind_methods()
Register editor properties.
Definition spawner.cpp:9
godot::Spawner::decrement_cars
void decrement_cars()
Listener for when a car is destroyed somehow. Decreases car counter.
Definition spawner.cpp:95
godot::Spawner::get_drone_scene
Ref< PackedScene > get_drone_scene() const
The scene to instantiate for drones.
Definition spawner.cpp:107
godot::Spawner::next
double next
Time at which the next spawn tick will go.
Definition spawner.hpp:53
godot::Spawner::tick
unsigned tick
The number of spawn ticks that have happened, could overflow, though that's not a problem.
Definition spawner.hpp:55
godot::Spawner::car_scene
Ref< PackedScene > car_scene
Definition spawner.hpp:57
enemy_spawnpoint.hpp
godot
Definition beacon_powerup.cpp:6
rally_rush_game_mode.hpp