Skip to main content

initializers Folder

Files Index

filehelios/engine/runtime/spawn/behavior/initializers/_module.ixx

Aggregate module for helios::engine::runtime::spawn::behavior::initializers namespace. More...

fileDelayedComponentEnablerInitializer.ixx

Initializer that schedules delayed activation of specified components. More...

fileEmitterInitializer.ixx

Initializer that configures spawned entities based on emitter state. More...

fileInitializerList.ixx

Composite initializer that chains multiple SpawnInitializers. More...

fileMoveInitializer.ixx

Spawn initializer that sets initial movement direction for spawned entities. More...

fileRandomDirectionInitializer.ixx

Initializer that configures spawned entities with random direction. More...

Description

helios::engine::runtime::spawn::behavior::initializers

Concrete SpawnInitializer implementations.

Overview

This module provides ready-to-use SpawnInitializer implementations for configuring spawned entities.

Key Classes

ClassPurpose
EmitterInitializerConfigures entity direction/velocity based on emitter state
MoveInitializerSets movement direction using various strategies (random, axis, point)
DelayedComponentEnablerInitializerDefers component activation with configurable delay

Usage

 // Projectiles inherit direction from firing entity
 auto profile = SpawnProfile{
  .gameObjectPoolId = bulletPoolId,
  .spawnPlacer = std::make_unique<EmitterSpawnPlacer>(),
  .spawnInitializer = std::make_unique<EmitterInitializer>()
 };
 
 // Enemies spawn with random movement directions
 auto enemyProfile = SpawnProfile{
  .gameObjectPoolId = enemyPoolId,
  .spawnPlacer = std::make_unique<RandomSpawnPlacer>(),
  .spawnInitializer = std::make_unique<MoveInitializer>(DirectionType::Random)
 };
 
 // Spawn with collision immunity for 0.5 seconds
 auto immuneProfile = SpawnProfile{
  .gameObjectPoolId = enemyPoolId,
  .spawnInitializer = std::make_unique<DelayedComponentEnablerInitializer>(
  0.5f, // delay in seconds
  std::vector<ComponentTypeId>{
  ComponentTypeId::of<CollisionComponent>()
  }
  )
 };

Delayed Component Activation

The DelayedComponentEnablerInitializer works with entities that have a DelayedComponentEnabler component attached (via LifecycleBuilder). It supports:

  • Fixed delay: All spawned entities activate after the same duration
  • Staggered delay: Sequential entities in a wave activate progressively
 // Staggered activation: each entity in wave activates 0.1s after previous
 auto staggeredInit = std::make_unique<DelayedComponentEnablerInitializer<CollisionComponent>>(
  0.1f, // base delay per entity
  5 // cycle length (resets after 5 entities)
 );


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.