Class StateGraphComposer
A helper class used to describe the StateGraph
nodes.
Inheritance
Namespace: AlchemyBow.Core.States
Assembly: AlchemyBow.Core.dll
Syntax
public sealed class StateGraphComposer
Constructors
StateGraphComposer(IState)
Creates an empty description of the StateGraph
node.
Declaration
public StateGraphComposer(IState state)
Parameters
Type | Name | Description |
---|---|---|
IState | state | The state associated with the node. ( |
Properties
Links
Returns all added links between the child nodes.
Declaration
public IReadOnlyList<StateGraphLink> Links { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IReadOnlyList<StateGraphLink> | All added links between the child nodes |
Nodes
Returns all added descriptions of the child nodes.
Declaration
public IReadOnlyList<StateGraphComposer> Nodes { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IReadOnlyList<StateGraphComposer> | All added descriptions of the child nodes |
State
Returns the state associated with the node if any.
Declaration
public IState State { get; }
Property Value
Type | Description |
---|---|
IState | The state associated with the node if any. |
Methods
AddLink(StateGraphComposer, StateGraphComposer, ICondition)
Adds a link (transition) between the specified child nodes.
Declaration
public void AddLink(StateGraphComposer from, StateGraphComposer to, ICondition condition)
Parameters
Type | Name | Description |
---|---|---|
StateGraphComposer | from | The origin child node. |
StateGraphComposer | to | The destination child node. |
ICondition | condition | The transition condition. |
AddNode(StateGraphComposer)
Adds a child node description.
Declaration
public void AddNode(StateGraphComposer composer)
Parameters
Type | Name | Description |
---|---|---|
StateGraphComposer | composer | The description of the child node. |
GetGraphPaths()
Returns all possible paths from root to leaves. Uses .ToString()
on the State
property value to determine path segment names.
Declaration
public List<string> GetGraphPaths()
Returns
Type | Description |
---|---|
System.Collections.Generic.List<System.String> | All possible paths from root to leaves. |
Remarks
This method is useful for debugging. However, consider using the #if UNITY_EDITOR
directive to avoid performance issues in the build.
Validate()
Throws exceptions if the graph node description is invalid.
Declaration
public void Validate()
Remarks
This method is useful for debugging. However, consider using the #if UNITY_EDITOR
directive to avoid performance issues in the build.