R-Type
Distributed multiplayer game engine in C++
Loading...
Searching...
No Matches
ecs::SpawnSystem Class Reference

System managing entity spawning and wave generation. More...

#include <SpawnSystem.hpp>

Inheritance diagram for ecs::SpawnSystem:
Inheritance graph
Collaboration diagram for ecs::SpawnSystem:
Collaboration graph

Public Member Functions

 SpawnSystem ()
 Constructs a SpawnSystem with default wave configuration.
 
 ~SpawnSystem () override=default
 Default destructor.
 
void update (Registry &registry, float deltaTime) override
 Manages entity spawning based on wave progression.
 
ComponentMask getComponentMask () const override
 Gets the component mask for this system.
 
- Public Member Functions inherited from ecs::ISystem
virtual ~ISystem ()=default
 Virtual destructor.
 

Private Member Functions

void _spawnEnemy (Registry &registry, const SpawnRequest &request)
 Internal method to spawn an enemy from a request.
 

Detailed Description

System managing entity spawning and wave generation.

Handles enemy waves, power-ups spawning, and entity creation based on game progression and patterns.

Processes SpawnRequest queues from Spawner components—the clean ECS way to handle dynamic spawning without tight coupling.

Definition at line 25 of file SpawnSystem.hpp.

Constructor & Destructor Documentation

◆ SpawnSystem()

ecs::SpawnSystem::SpawnSystem ( )

Constructs a SpawnSystem with default wave configuration.

Initializes with wave 1, 5 enemies per wave, and 2-second spawn interval.

Definition at line 21 of file SpawnSystem.cpp.

◆ ~SpawnSystem()

ecs::SpawnSystem::~SpawnSystem ( )
overridedefault

Default destructor.

Member Function Documentation

◆ _spawnEnemy()

void ecs::SpawnSystem::_spawnEnemy ( Registry registry,
const SpawnRequest request 
)
private

Internal method to spawn an enemy from a request.

Parameters
registryReference to the ECS registry
requestThe spawn request with all parameters

Definition at line 95 of file SpawnSystem.cpp.

References ecs::SpawnRequest::enemyType, ecs::SpawnRequest::health, LOG_ERROR, ecs::Registry::newEntity(), ecs::SpawnRequest::scoreValue, ecs::SpawnRequest::scriptPath, ecs::Registry::setComponent(), ecs::SpawnRequest::x, and ecs::SpawnRequest::y.

Referenced by update().

Here is the call graph for this function:

◆ getComponentMask()

ComponentMask ecs::SpawnSystem::getComponentMask ( ) const
overridevirtual

Gets the component mask for this system.

Returns
ComponentMask of 0 (this system doesn't filter entities, it creates them)

Implements ecs::ISystem.

Definition at line 146 of file SpawnSystem.cpp.

◆ update()

void ecs::SpawnSystem::update ( Registry registry,
float  deltaTime 
)
overridevirtual

Manages entity spawning based on wave progression.

Processes spawn requests from Spawner components. Handles the actual entity creation with all components.

Parameters
registryReference to the ECS registry
deltaTimeTime elapsed since last frame (in seconds)

Implements ecs::ISystem.

Definition at line 23 of file SpawnSystem.cpp.

References _spawnEnemy(), ecs::Spawner::currentWaveIndex, ecs::WaveConfig::enemies, ecs::Registry::getComponent(), ecs::Spawner::getConfig(), ecs::Spawner::getConfigMutable(), ecs::Spawner::isActive, LOG_INFO, LOG_WARNING, ecs::Registry::view(), ecs::Spawner::waveElapsedTime, ecs::SpawnerConfig::waves, and ecs::SpawnerConfig::wavesIntervals.

Here is the call graph for this function:

The documentation for this class was generated from the following files: