SStateMachine
| 函数 | NextState | Enter the next state |
| 函数 | PrevState | – |
| 函数 | SetState | Enters the state of being set that its order is "state" |
| 函数 | 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. |
| 属性 | Enabled | Whether the simple state machine component is Enabled or not |
| 属性 | StateCount | Total number of States. |
| 属性 | StateNames | A list of the names of all States. |
| 属性 | CurrentState | The index number of the current state. |
| 属性 | CurrentStateName | The name of the current state, or null if no state. |
| 属性 | ComponentName | The name of this component. |
| 属性 | GameObject | The GameObject this component is attached to. |
函数
NextState
Enter the next state
返回值
void
示例
Space.Host.ExecutingObject.StateMachine.NextState()
PrevState
返回值
void
示例
Space.Host.ExecutingObject.StateMachine.PrevState()
SetState
Enters the state of being set that its order is "state"
参数
| 参数 | 类型 | 说明 |
|---|---|---|
| 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. |
返回值
void
示例
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
参数
| 参数 | 类型 | 说明 |
|---|---|---|
| go | SGameObject | A specific SGameObject which this State Machine will bind to. |
返回值
void
示例
Space.Host.ExecutingObject.StateMachine.BindToUI()
----or
Space.Host.ExecutingObject.StateMachine.BindToUI(Space.Host.GetReference("a reference"))
属性
Enabled
Whether the simple state machine component is Enabled or not
示例
Space.Host.ExecutingObject.StateMachine.Enabled = false
StateCount只读
Total number of States.
示例
numberOfStates = Space.Host.ExecutingObject.StateMachine.StateCount
StateNames只读
A list of the names of all States.
示例
tableStateNames = Space.Host.ExecutingObject.StateMachine.StateNames
CurrentState只读
The index number of the current state.
示例
currentState = Space.Host.ExecutingObject.StateMachine.CurrentState
CurrentStateName只读
The name of the current state, or null if no state.
示例
currentStateName = Space.Host.ExecutingObject.StateMachine.CurrentStateName
ComponentName只读
The name of this component.
示例
componentName = Space.Host.ExecutingObject.StateMachine.ComponentName
GameObject只读
The GameObject this component is attached to. A component is always attached to a GameObject.
示例
theGameObject = Space.Host.ExecutingObject.StateMachine.GameObject



