StateMachineComponent<T>
Namespace: Bang.StateMachines
Assembly: Bang.dll
public sealed struct StateMachineComponent<T> : IStateMachineComponent, IComponent, IModifiableComponent
Implements a state machine component.
Implements: IStateMachineComponent, IComponent, IModifiableComponent
⭐ Constructors
public StateMachineComponent<T>()
Creates a new StateMachineComponent
public StateMachineComponent<T>(T routine)
Parameters
routine
T
⭐ Properties
State
public virtual string State { get; }
This will fire a notification whenever the state changes.
Returns
string
⭐ Methods
Tick(float)
public virtual bool Tick(float seconds)
Tick a yield operation in the state machine. The next tick will be called according to the returned WaitKind.
Parameters
seconds
float
Returns
bool
Initialize(World, Entity)
public virtual void Initialize(World world, Entity e)
Initialize the state machine with the world knowledge. Called before any tick.
Parameters
world
World
e
Entity
OnDestroyed()
public virtual void OnDestroyed()
Called right before the component gets destroyed.
Subscribe(Action)
public virtual void Subscribe(Action notification)
Subscribe for notifications on this component.
Parameters
notification
Action
Unsubscribe(Action)
public virtual void Unsubscribe(Action notification)
Stop listening to notifications on this component.
Parameters
notification
Action
⚡