SStateMachine
On this classNextState
| Function | NextState | Enter the next state |
| Function | PrevState | – |
| Function | SetState | Enters the state of being set that its order is "state" |
| Function | BindToUI | The state machine will bind itself to all Toggles, Buttons, Dropdowns and Sliders on the SGameObject it is in or on a specified SGameObject. |
| Property | Enabled | Whether the simple state machine component is Enabled or not |
| Property | StateCount | Total number of States. |
| Property | StateNames | A list of the names of all States. |
| Property | CurrentState | The index number of the current state. |
| Property | CurrentStateName | The name of the current state, or null if no state. |
| Property | ComponentName | The name of this component. |
| Property | GameObject | The GameObject this component is attached to. |
Functions
NextState
Enter the next state
Returns
void
Example
Space.Host.ExecutingObject.StateMachine.NextState()
PrevState
Returns
void
Example
Space.Host.ExecutingObject.StateMachine.PrevState()
SetState
Enters the state of being set that its order is "state"
Parameters
| Parameter | Type | Description |
|---|---|---|
| state | int | The index of the state. First state is 1. |
| state | string | The name of the state as set in the State Machine component. |
Returns
void
Example
Space.Host.ExecutingObject.StateMachine.SetState(2)
--or
Space.Host.ExecutingObject.StateMachine.SetState('A State Name')
BindToUI
The state machine will bind itself to all Toggles, Buttons, Dropdowns and Sliders on the SGameObject it is in or on a specified SGameObject.
Binding to Button : Clicking button will call NextState()
Binding to Toggle: Toggle On sets State to 1, Toggle Off sets state to 2
Binding to Dropdown: Selecting will set State to that selection's caption text
Binding to Slider: Moving slider changes State to slider value
Parameters
| Parameter | Type | Description |
|---|---|---|
| go | SGameObject | A specific SGameObject which this State Machine will bind to. |
Returns
void
Example
Space.Host.ExecutingObject.StateMachine.BindToUI()
----or
Space.Host.ExecutingObject.StateMachine.BindToUI(Space.Host.GetReference("a reference"))
Properties
Enabled
Whether the simple state machine component is Enabled or not
Example
Space.Host.ExecutingObject.StateMachine.Enabled = false
StateCountRead only
Total number of States.
Example
numberOfStates = Space.Host.ExecutingObject.StateMachine.StateCount
StateNamesRead only
A list of the names of all States.
Example
tableStateNames = Space.Host.ExecutingObject.StateMachine.StateNames
CurrentStateRead only
The index number of the current state.
Example
currentState = Space.Host.ExecutingObject.StateMachine.CurrentState
CurrentStateNameRead only
The name of the current state, or null if no state.
Example
currentStateName = Space.Host.ExecutingObject.StateMachine.CurrentStateName
ComponentNameRead only
The name of this component.
Example
componentName = Space.Host.ExecutingObject.StateMachine.ComponentName
GameObjectRead only
The GameObject this component is attached to. A component is always attached to a GameObject.
Example
theGameObject = Space.Host.ExecutingObject.StateMachine.GameObject



