27 for (
auto spawner : spawners) {
35 int wavesCount =
static_cast<int>(config.
waves.size());
40 LOG_WARNING(
"[SpawnSystem] Invalid wave configuration - missing intervals");
57 for (
auto &enemy : currentWave.
enemies) {
58 if (!enemy.hasSpawned && spawnerComp.
waveElapsedTime >= enemy.spawnDelay) {
60 enemy.hasSpawned =
true;
67 bool allSpawned =
true;
68 for (
const auto &enemy : currentWave.
enemies) {
69 if (!enemy.hasSpawned) {
82 LOG_INFO(
"[SpawnSystem] All waves completed for this spawner.");
86 for (
auto &enemy : nextWave.
enemies) {
87 enemy.hasSpawned =
false;
101 float speed = 150.0f;
102 float colliderWidth = 40.0f;
103 float colliderHeight = 40.0f;
108 colliderWidth = 40.0f;
109 colliderHeight = 40.0f;
113 colliderWidth = 60.0f;
114 colliderHeight = 60.0f;
115 }
else if (request.
enemyType ==
"fast") {
118 colliderWidth = 30.0f;
119 colliderHeight = 30.0f;
120 }
else if (request.
enemyType ==
"boss") {
123 colliderWidth = 80.0f;
124 colliderHeight = 80.0f;
133 enemy,
Collider(colliderWidth, colliderHeight, 0.0f, 0.0f, 2, 0xFFFFFFFF,
false));
135 Weapon(0.33f, 2.0f, 1, 30));
141 }
catch (
const std::exception &e) {
142 LOG_ERROR(
"[SpawnSystem] Failed to spawn enemy: ", e.what());
Component for collision detection and physics interactions.
Component identifying an entity as an enemy with AI behavior.
Component representing entity health and invincibility.
Component that holds the path to a Lua script for entity behavior.
Manages entities, their signatures and component type registrations.
Address newEntity()
Create and register a new entity, returning its Address.
T & getComponent(Address address)
Get a component from an entity.
std::vector< Address > view()
Get all entities that have a specific set of components.
void setComponent(Address address, const T &component)
Set/add a component to an entity with its data.
SpawnSystem()
Constructs a SpawnSystem with default wave configuration.
void _spawnEnemy(Registry ®istry, const SpawnRequest &request)
Internal method to spawn an enemy from a request.
ComponentMask getComponentMask() const override
Gets the component mask for this system.
void update(Registry ®istry, float deltaTime) override
Manages entity spawning based on wave progression.
Component that holds spawn requests to be processed by SpawnSystem.
const SpawnerConfig & getConfig() const
SpawnerConfig & getConfigMutable()
Component representing movement direction and speed.
Component for entities capable of shooting projectiles.
Maximum number of distinct component types supported by the Registry.
std::uint32_t Address
Type used to represent an entity address/ID.
std::uint64_t ComponentMask
Type alias for component bitmask.
Declarative request for spawning an entity.
std::vector< WaveConfig > waves
std::vector< int > wavesIntervals
std::vector< SpawnRequest > enemies