Sinespace Client  2023.2.17543
Client-side scripting for Sinespace
SineSpace.Scripting.Components.SStateMachine Class Reference
Inheritance diagram for SineSpace.Scripting.Components.SStateMachine:
ScriptClassComponent< SimpleStateMachineBaseInternal >

Public Member Functions

void NextState ()
 Enter the next state More...
 
void PrevState ()
 Enter the previous state More...
 
void SetState (int state)
 Enters the state of being set that its order is "state" More...
 
void SetState (string state)
 Enters the state of being set that its name is "state" More...
 
void BindToUI ()
 State machine will attach to Toggles, Buttons and Dropdowns More...
 
void BindToUI (SGameObject go)
 State machine will bind to the gameobject "go". More...
 

Properties

bool Enabled [get, set]
 Whether the simple state machine component is Enabled or not More...
 
bool Ready [get]
 Returns true if the state machine is not currently waiting for any events to finish. Events may be pending if they are waiting on scripting runtimes to finish initializing. More...
 
string ComponentName [get]
 Return the component name of the state machine More...
 
int StateCount [get]
 Return the count of states More...
 
string[] StateNames [get]
 Return a list of names of states More...
 
int CurrentState [get]
 Return the index number of the current state More...
 
string CurrentStateName [get]
 Return the name of the current state, or null if no state. More...
 
- Properties inherited from ScriptClassComponent< SimpleStateMachineBaseInternal >
SGameObject GameObject [get]
 Return the GameObject which component added. More...
 

Member Function Documentation

◆ BindToUI() [1/2]

void SineSpace.Scripting.Components.SStateMachine.BindToUI ( )

State machine will attach to Toggles, Buttons and Dropdowns

local thisObject=Space.Host.ExecutingObject
local stateMachine=thisObject.StateMachine
function Bind()
stateMachine.BindToUI()
end

◆ BindToUI() [2/2]

void SineSpace.Scripting.Components.SStateMachine.BindToUI ( SGameObject  go)

State machine will bind to the gameobject "go".

local thisObject=Space.Host.ExecutingObject
local stateMachine=thisObject.StateMachine
local button=Space.Host.GetReference("Button")
function Bind()
stateMachine.BindToUI(button)
end
function Cur()
local current=stateMachine.CurrentState
Space.Log(current)
end

◆ NextState()

void SineSpace.Scripting.Components.SStateMachine.NextState ( )

Enter the next state

local thisObject=Space.Host.ExecutingObject
local stateMachine=thisObject.StateMachine
function NextState()
stateMachine.NextState()
end
function Cur()
local current=stateMachine.CurrentState
Space.Log(current)
end

◆ PrevState()

void SineSpace.Scripting.Components.SStateMachine.PrevState ( )

Enter the previous state

local thisObject=Space.Host.ExecutingObject
local stateMachine=thisObject.StateMachine
function PrevState()
stateMachine.PrevState()
end
function Cur()
local current=stateMachine.CurrentState
Space.Log(current)
end

◆ SetState() [1/2]

void SineSpace.Scripting.Components.SStateMachine.SetState ( int  state)

Enters the state of being set that its order is "state"

local thisObject=Space.Host.ExecutingObject
local stateMachine=thisObject.StateMachine
function SetState()
stateMachine.SetState(1)
end
function Cur()
local current=stateMachine.CurrentState
Space.Log(current)
end
Parameters
stateThe number of state

◆ SetState() [2/2]

void SineSpace.Scripting.Components.SStateMachine.SetState ( string  state)

Enters the state of being set that its name is "state"

local thisObject=Space.Host.ExecutingObject
local stateMachine=thisObject.StateMachine
function SetState()
stateMachine.SetState("no1")
end
function Cur()
local current=stateMachine.CurrentState
Space.Log(current)
end
Parameters
stateThe name of state

Property Documentation

◆ ComponentName

string SineSpace.Scripting.Components.SStateMachine.ComponentName
get

Return the component name of the state machine

local thisObject=Space.Host.ExecutingObject
local machine=thisObject.StateMachine
Space.Log(machine.ComponentName)

◆ CurrentState

int SineSpace.Scripting.Components.SStateMachine.CurrentState
get

Return the index number of the current state

local thisObject=Space.Host.ExecutingObject
local stateMachine=thisObject.StateMachine;
local current=stateMachine.CurrentState
Space.Log(current)

◆ CurrentStateName

string SineSpace.Scripting.Components.SStateMachine.CurrentStateName
get

Return the name of the current state, or null if no state.

local thisObject=Space.Host.ExecutingObject
local stateMachine=thisObject.StateMachine;
local current=stateMachine.CurrentStateName
Space.Log(current)

◆ Enabled

bool SineSpace.Scripting.Components.SStateMachine.Enabled
getset

Whether the simple state machine component is Enabled or not

local thisObject=Space.Host.ExecutingObject
local stateMachine=thisObject.StateMachine;
local enabled=stateMachine.Enabled
Space.Log(enabled)

◆ Ready

bool SineSpace.Scripting.Components.SStateMachine.Ready
get

Returns true if the state machine is not currently waiting for any events to finish. Events may be pending if they are waiting on scripting runtimes to finish initializing.

local thisObject=Space.Host.ExecutingObject
local stateMachine=thisObject.StateMachine;
local ready=stateMachine.Ready
Space.Log(ready)

◆ StateCount

int SineSpace.Scripting.Components.SStateMachine.StateCount
get

Return the count of states

local thisObject=Space.Host.ExecutingObject
local stateMachine=thisObject.StateMachine;
local count=stateMachine.StateCount
Space.Log(count)

◆ StateNames

string [] SineSpace.Scripting.Components.SStateMachine.StateNames
get

Return a list of names of states

local thisObject=Space.Host.ExecutingObject
local stateMachine=thisObject.StateMachine;
local names=stateMachine.StateNames
for i=1, #names do
Space.Log(names[i])
end
SineSpace.Scripting.Components.SStateMachine.CurrentState
int CurrentState
Return the index number of the current state
Definition: SStateMachine.cs:107
SineSpace.Scripting.Components.SStateMachine.NextState
void NextState()
Enter the next state
Definition: SStateMachine.cs:143
SineSpace.Scripting.Components.SStateMachine.SetState
void SetState(int state)
Enters the state of being set that its order is "state"
Definition: SStateMachine.cs:186
SineSpace.Scripting.Components.SStateMachine.BindToUI
void BindToUI()
State machine will attach to Toggles, Buttons and Dropdowns
Definition: SStateMachine.cs:225
SineSpace.Scripting.Components.SStateMachine.PrevState
void PrevState()
Enter the previous state
Definition: SStateMachine.cs:164