Skip to main content

InitializerList Class Template

Composite initializer that executes multiple SpawnInitializers in sequence. More...

Declaration

template <std::size_t N> class helios::engine::runtime::spawn::behavior::initializers::InitializerList<N> { ... }

Base class

classSpawnInitializer

Abstract interface for initializing spawned entity state. More...

Public Constructors Index

template <typename... Args>
InitializerList (std::unique_ptr< Args > &&...args)

Constructs an InitializerList from variadic initializer arguments. More...

Public Member Functions Index

template <std::size_t N>
voidinitialize (helios::engine::ecs::GameObject gameObject, const SpawnPlanCursor &cursor, const SpawnContext &spawnContext) override

Executes all initializers in sequence on the spawned GameObject. More...

Private Member Attributes Index

template <std::size_t N>
const std::array< std::unique_ptr< SpawnInitializer >, N >initializers_

Fixed-size array of initializers to execute. More...

Description

Composite initializer that executes multiple SpawnInitializers in sequence.

InitializerList allows combining multiple initialization behaviors into a single initializer. Each initializer in the list is executed in order during the spawn process.

**Usage:** ```cpp auto initializer = std::make_unique<InitializerList<2>>( std::make_unique<DirectionInitializer>(vec3f{1, 0, 0}), std::make_unique<VelocityInitializer>(100.0f) ); ```

Template Parameters
N

The number of initializers in the list. Must match the number of arguments passed to the constructor.

See Also

SpawnInitializer

See Also

SpawnContext

Definition at line 42 of file InitializerList.ixx.

Public Constructors

InitializerList()

template <typename... Args>
helios::engine::runtime::spawn::behavior::initializers::InitializerList< N >::InitializerList (std::unique_ptr< Args > &&... args)
inline explicit

Constructs an InitializerList from variadic initializer arguments.

Template Parameters
Args

Types of the initializer unique_ptrs.

Parameters
args

Unique pointers to SpawnInitializer instances. The number of arguments must match the template parameter N.

Definition at line 61 of file InitializerList.ixx.

61 explicit InitializerList(std::unique_ptr<Args>&& ...args) : initializers_{std::move(args)...}{}

Public Member Functions

initialize()

template <std::size_t N>
void helios::engine::runtime::spawn::behavior::initializers::InitializerList< N >::initialize (helios::engine::ecs::GameObject gameObject, const SpawnPlanCursor & cursor, const SpawnContext & spawnContext)
inline virtual

Executes all initializers in sequence on the spawned GameObject.

Parameters
gameObject

The GameObject being initialized.

cursor

The current spawn plan cursor with batch and index information.

spawnContext

Context providing access to spawn-related data.

Definition at line 70 of file InitializerList.ixx.

72 const SpawnPlanCursor& cursor,
73 const SpawnContext& spawnContext
74 ) override {
75 for (std::size_t i = 0; i < initializers_.size(); ++i) {
76 initializers_[i]->initialize(
77 gameObject,
78 cursor,
79 spawnContext
80 );
81 }
82 }

Private Member Attributes

initializers_

template <std::size_t N>
const std::array<std::unique_ptr<SpawnInitializer>, N> helios::engine::runtime::spawn::behavior::initializers::InitializerList< N >::initializers_

Fixed-size array of initializers to execute.

Definition at line 47 of file InitializerList.ixx.

47 const std::array<std::unique_ptr<SpawnInitializer>, N> initializers_;

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


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.