Skip to main content

WorldCommand Class

Abstract base class for commands that operate on the entire GameWorld. More...

Declaration

class helios::engine::runtime::messaging::command::WorldCommand { ... }

Derived Classes

classUpdateScoreCommand

Command that carries score update information. More...

classDespawnCommand

Command to request despawning of a GameObject. More...

classScheduledSpawnPlanCommand

Command for executing a scheduled spawn plan. More...

classSpawnCommand

Command to request spawning of GameObjects from a pool. More...

Public Destructor Index

~WorldCommand ()=default

Virtual destructor to ensure proper cleanup of derived classes. More...

Public Member Functions Index

voidexecute (helios::engine::runtime::world::GameWorld &gameWorld) const noexcept=0

Executes the command against the entire GameWorld. More...

voidaccept (helios::engine::runtime::world::GameWorld &gameWorld, helios::engine::runtime::messaging::command::WorldCommandDispatcher &dispatcher) const noexcept

Accepts a dispatcher for type-safe command handling. More...

Description

Abstract base class for commands that operate on the entire GameWorld.

Unlike TargetedCommand which operates on a specific GameObject, a WorldCommand executes against the entire GameWorld. This is useful for global game actions such as spawning entities, clearing levels, or applying world-wide effects.

WorldCommands support the Visitor pattern through accept(), enabling type-safe dispatch to specialized handlers without explicit type checking.

See Also

TargetedCommand for commands targeting specific GameObjects

See Also

WorldCommandDispatcher for type-safe command dispatch

Definition at line 31 of file WorldCommand.ixx.

Public Destructor

~WorldCommand()

virtual helios::engine::runtime::messaging::command::WorldCommand::~WorldCommand ()
virtual default

Virtual destructor to ensure proper cleanup of derived classes.

Definition at line 38 of file WorldCommand.ixx.

Public Member Functions

accept()

virtual void helios::engine::runtime::messaging::command::WorldCommand::accept (helios::engine::runtime::world::GameWorld & gameWorld, helios::engine::runtime::messaging::command::WorldCommandDispatcher & dispatcher)
inline noexcept virtual

Accepts a dispatcher for type-safe command handling.

Parameters
gameWorld

The game world context.

dispatcher

The dispatcher to delegate command handling to.

Override this method in derived commands to enable dispatch to specialized handlers. The default implementation is a no-op.

Definition at line 58 of file WorldCommand.ixx.

58 virtual void accept(
61 // no-op by default
62 }

execute()

virtual void helios::engine::runtime::messaging::command::WorldCommand::execute (helios::engine::runtime::world::GameWorld & gameWorld)
noexcept

Executes the command against the entire GameWorld.

Parameters
gameWorld

The game world to apply the command to.

info

Implementations must be exception-safe (noexcept).

Definition at line 47 of file WorldCommand.ixx.


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


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.