SStateMachine
Dans cette classeNextState
| Fonction | NextState | Enter the next state |
| Fonction | PrevState | – |
| Fonction | SetState | Enters the state of being set that its order is "state" |
| Fonction | 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. |
| Propriété | Enabled | Whether the simple state machine component is Enabled or not |
| Propriété | StateCount | Total number of States. |
| Propriété | StateNames | A list of the names of all States. |
| Propriété | CurrentState | The index number of the current state. |
| Propriété | CurrentStateName | The name of the current state, or null if no state. |
| Propriété | ComponentName | The name of this component. |
| Propriété | GameObject | The GameObject this component is attached to. |
Fonctions
NextState
Enter the next state
Valeurs de retour
void
Exemple
Space.Host.ExecutingObject.StateMachine.NextState()
PrevState
Valeurs de retour
void
Exemple
Space.Host.ExecutingObject.StateMachine.PrevState()
SetState
Enters the state of being set that its order is "state"
Paramètres
| Paramètre | 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. |
Valeurs de retour
void
Exemple
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
Paramètres
| Paramètre | Type | Description |
|---|---|---|
| go | SGameObject | A specific SGameObject which this State Machine will bind to. |
Valeurs de retour
void
Exemple
Space.Host.ExecutingObject.StateMachine.BindToUI()
----or
Space.Host.ExecutingObject.StateMachine.BindToUI(Space.Host.GetReference("a reference"))
Propriétés
Enabled
Whether the simple state machine component is Enabled or not
Exemple
Space.Host.ExecutingObject.StateMachine.Enabled = false
StateCountLecture seule
Total number of States.
Exemple
numberOfStates = Space.Host.ExecutingObject.StateMachine.StateCount
StateNamesLecture seule
A list of the names of all States.
Exemple
tableStateNames = Space.Host.ExecutingObject.StateMachine.StateNames
CurrentStateLecture seule
The index number of the current state.
Exemple
currentState = Space.Host.ExecutingObject.StateMachine.CurrentState
CurrentStateNameLecture seule
The name of the current state, or null if no state.
Exemple
currentStateName = Space.Host.ExecutingObject.StateMachine.CurrentStateName
ComponentNameLecture seule
The name of this component.
Exemple
componentName = Space.Host.ExecutingObject.StateMachine.ComponentName
GameObjectLecture seule
The GameObject this component is attached to. A component is always attached to a GameObject.
Exemple
theGameObject = Space.Host.ExecutingObject.StateMachine.GameObject



