SStateMachine
Index
Functions Index
| Function Name |
|---|
| void NextState () |
| void PrevState () |
Properties Index
| Property Name |
|---|
bool Enabled get set |
int StateCount get |
string[] StateNames get |
int CurrentState get |
string CurrentStateName get |
string ComponentName get |
SGameObject GameObject get |
Functions
NextState
void NextState ()
Enter the next state
- Lua
Space.Host.ExecutingObject.StateMachine.NextState()
PrevState
void PrevState ()
- Lua
Space.Host.ExecutingObject.StateMachine.PrevState()
SetState
void SetState (int state)
void SetState (string state)
Enters the state of being set that its order is "state"
| 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. |
- Lua
Space.Host.ExecutingObject.StateMachine.SetState(2)
--or
Space.Host.ExecutingObject.StateMachine.SetState('A State Name')
BindToUI
void BindToUI ()
void BindToUI (SGameObject go)
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
| Parameter | Type | Description |
|---|---|---|
| go | SGameObject | A specific SGameObject which this State Machine will bind to. |
- Lua
Space.Host.ExecutingObject.StateMachine.BindToUI()
----or
Space.Host.ExecutingObject.StateMachine.BindToUI(Space.Host.GetReference("a reference"))
Properties
Enabled
bool Enabled get set
Whether the simple state machine component is Enabled or not
- Lua
Space.Host.ExecutingObject.StateMachine.Enabled = false
StateCount
int StateCount get
Total number of States.
- Lua
numberOfStates = Space.Host.ExecutingObject.StateMachine.StateCount
StateNames
string[] StateNames get
A list of the names of all States.
- Lua
tableStateNames = Space.Host.ExecutingObject.StateMachine.StateNames
CurrentState
int CurrentState get
The index number of the current state.
- Lua
currentState = Space.Host.ExecutingObject.StateMachine.CurrentState
CurrentStateName
string CurrentStateName get
The name of the current state, or null if no state.
- Lua
currentStateName = Space.Host.ExecutingObject.StateMachine.CurrentStateName
ComponentName
string ComponentName get
The name of this component.
- Lua
componentName = Space.Host.ExecutingObject.StateMachine.ComponentName
GameObject
SGameObject GameObject get
The GameObject this component is attached to. A component is always attached to a GameObject.
- Lua
theGameObject = Space.Host.ExecutingObject.StateMachine.GameObject