Class ScyllaHierarchicalStateMachine<TContext>
A hierarchical state machine built from ScyllaCompositeState<TContext> states. Extends ScyllaStateMachine<TContext> with queries over the active root-to-leaf state chain.
Inherited Members
Namespace: Scylla.Core.Structures
Assembly: ScyllaCore.dll
Syntax
public class ScyllaHierarchicalStateMachine<TContext> : ScyllaStateMachine<TContext>
Type Parameters
| Name | Description |
|---|---|
| TContext | The shared context type passed to every state callback. |
Remarks
The hierarchy is expressed through state composition: any state on the machine may be a ScyllaCompositeState<TContext> owning a child machine, and composites may nest arbitrarily deep. Ticks flow down the chain because each composite forwards them to its child machine.
var grounded = new ScyllaCompositeState<PlayerContext>(context, idleState);
var machine = new ScyllaHierarchicalStateMachine<PlayerContext>(context);
machine.Start(grounded);
grounded.ChildMachine.TransitionTo(movingState);
machine.GetActivePath(pathBuffer); /* [grounded, movingState] */
Constructors
ScyllaHierarchicalStateMachine(TContext)
Creates a new hierarchical state machine operating on the given context.
Declaration
public ScyllaHierarchicalStateMachine(TContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| TContext | context | The shared context passed to every state callback. |
Methods
GetActivePath(List<IScyllaState<TContext>>)
Fills the given buffer with the active state chain from the machine's current state down to the deepest active leaf, walking through nested composite states. The buffer is cleared first. Produces an empty buffer while the machine is stopped.
Declaration
public void GetActivePath(List<IScyllaState<TContext>> buffer)
Parameters
| Type | Name | Description |
|---|---|---|
| List<IScyllaState<TContext>> | buffer | A caller-provided list receiving the path; reusing one buffer across calls avoids allocations. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown when |
IsInState(IScyllaState<TContext>)
Determines whether the given state is anywhere on the active root-to-leaf chain, including as an intermediate composite state.
Declaration
public bool IsInState(IScyllaState<TContext> state)
Parameters
| Type | Name | Description |
|---|---|---|
| IScyllaState<TContext> | state | The state to look for. |
Returns
| Type | Description |
|---|---|
| bool |
|