StateManager.ixx File
Generic state manager and transition orchestrator. More...
Included Headers
#include <memory>
#include <span>
#include <vector>
#include <helios.engine.common>
#include <helios.util.Guid>
#include <helios.engine.state.TypedStateCommandHandler>
#include <helios.engine.state.types>
#include <helios.engine.state.StateTransitionListener>
#include <helios.engine.state.types.StateTransitionRule>
#include <helios.engine.runtime.world.Session>
#include <helios.engine.runtime.world.GameWorld>
#include <helios.engine.state.commands>
#include <helios.engine.ecs.GameObject>
#include <helios.engine.runtime.messaging.command>
#include <helios.core.types>
#include <helios.engine.state.components>
#include <helios.engine.runtime.world.UpdateContext>
Namespaces Index
| namespace | helios |
| namespace | engine |
|
Main engine module aggregating core infrastructure and game systems. More... | |
| namespace | state |
|
Generic, template-based state management system. More... | |
Classes Index
| class | StateManager<StateType> |
|
Manages state transitions using a rule-based system. More... | |
Description
Generic state manager and transition orchestrator.
File Listing
The file content with the documentation metadata removed is:
38using namespace helios::engine::state::types;
39using namespace helios::engine::state::commands;
40using namespace helios::engine::runtime::messaging::command;
42export namespace helios::engine::state {
69 class StateManager {
97 const StateTransitionIdType<StateType> transitionId,
98 helios::engine::runtime::world::UpdateContext& updateContext) {
116 const StateTransitionIdType<StateType> transitionId,
117 helios::engine::runtime::world::UpdateContext& updateContext) {
122 StateTransitionContext<StateType>{from, to, transitionId}
138 const StateTransitionIdType<StateType> transitionId,
139 helios::engine::runtime::world::UpdateContext& updateContext) {
156 explicit StateManager(std::span<const StateTransitionRule<StateType>> rules)
166 StateManager& addStateListener(std::unique_ptr<StateTransitionListener<StateType>> listener) noexcept {
180 helios::engine::runtime::world::UpdateContext& updateContext
187 auto command = pending_.back();
189 auto transitionRequest = command.transitionRequest();
191 auto& session = updateContext.session();
192 auto currentFrom = session.state<StateType>();
214 session.setStateFrom<StateType>(StateTransitionContext<StateType>{rule.from(), rule.to(), transitionId});
230 const StateCommand<StateType> stateCommand
250 const DelayedStateCommand<StateType> stateCommand
252 pending_.push_back(StateCommand<StateType>(stateCommand.transitionRequest()));
261 void init(helios::engine::runtime::world::GameWorld& gameWorld) {
262 gameWorld.registerCommandHandler<StateCommand<StateType>>(*this);
263 gameWorld.registerCommandHandler<DelayedStateCommand<StateType>>(*this);
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.