Breakroom is now Sinewave Campus. Book a meeting

SStateMachine

العميلالمكونات
في هذا الصنفNextState
  1. الدوال
  2. NextState
  3. PrevState
  4. SetState
  5. BindToUI
  6. الخصائص
  7. Enabled
  8. StateCount
  9. StateNames
  10. CurrentState
  11. CurrentStateName
  12. ComponentName
  13. GameObject
الأعضاء 11
دالةNextStateEnter the next state
دالةPrevState–
دالةSetStateEnters the state of being set that its order is "state"
دالةBindToUIThe state machine will bind itself to all Toggles, Buttons, Dropdowns and Sliders on the SGameObject it is in or on a specified SGameObject.
خاصيةEnabledWhether the simple state machine component is Enabled or not
خاصيةStateCountTotal number of States.
خاصيةStateNamesA list of the names of all States.
خاصيةCurrentStateThe index number of the current state.
خاصيةCurrentStateNameThe name of the current state, or null if no state.
خاصيةComponentNameThe name of this component.
خاصيةGameObjectThe GameObject this component is attached to.

الدوال​

NextState​

void NextState()

Enter the next state

القيم المرجعة

void

مثال

Lua
Space.Host.ExecutingObject.StateMachine.NextState()

PrevState​

void PrevState()

القيم المرجعة

void

مثال

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"

المعاملات

المعاملالنوعالوصف
stateintThe index of the state. First state is 1.
statestringThe name of the state as set in the State Machine component.

القيم المرجعة

void

مثال

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

المعاملات

المعاملالنوعالوصف
goSGameObjectA specific SGameObject which this State Machine will bind to.

القيم المرجعة

void

مثال

Lua
Space.Host.ExecutingObject.StateMachine.BindToUI()
----or
Space.Host.ExecutingObject.StateMachine.BindToUI(Space.Host.GetReference("a reference"))

الخصائص​

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