Class StateBusComponent
MonoBehaviour that maintains runtime state for the procedural animation system. All state is key-based: StateKeyId → float mappings. Implements IStateReader for domain compatibility.
Implements
Namespace: Serenity.ProceduralExpression.Infrastructure.Components
Assembly: Serenity.UnityProceduralExpression.Infrastructure.dll
Syntax
public class StateBusComponent : MonoBehaviour, IStateReader
Constructors
StateBusComponent()
Declaration
public StateBusComponent()
Properties
AllState
Gets all current state keys and their values (for debugging).
Declaration
public IReadOnlyDictionary<string, float> AllState { get; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyDictionary<string, float> |
Methods
Clear()
Clears all state values.
Declaration
public void Clear()
Get(UnityStateKey, float)
Gets a state value by UnityStateKey.
Declaration
public float Get(UnityStateKey key, float defaultValue = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| UnityStateKey | key | |
| float | defaultValue |
Returns
| Type | Description |
|---|---|
| float |
Remove(UnityStateKey)
Removes a specific state key.
Declaration
public void Remove(UnityStateKey key)
Parameters
| Type | Name | Description |
|---|---|---|
| UnityStateKey | key |
Set(UnityStateKey, float, bool)
Sets a state value by UnityStateKey.
Declaration
public void Set(UnityStateKey key, float value, bool clampToRangeHint = false)
Parameters
| Type | Name | Description |
|---|---|---|
| UnityStateKey | key | The state key. |
| float | value | The value to set. |
| bool | clampToRangeHint | If true, clamps the value to the key's range hint. |
TryGet(UnityStateKey, out float)
Tries to get a state value by UnityStateKey.
Declaration
public bool TryGet(UnityStateKey key, out float value)
Parameters
| Type | Name | Description |
|---|---|---|
| UnityStateKey | key | |
| float | value |
Returns
| Type | Description |
|---|---|
| bool |