Sinespace Client 2025.3.19431
Client-side scripting for Sinespace
SineSpace.Scripting.Components.SStateMachine Class Reference
Inheritance diagram for SineSpace.Scripting.Components.SStateMachine:
ScriptClassComponent< T > ScriptClass< T > ScriptClassWrapper< T > ScriptClass

Public Member Functions

void NextState ()
 Enter the next state.
 
void PrevState ()
 Enter the previous state.
 
void SetState (int state)
 Enters the state of being set that its order is "state".
 
void SetState (string state)
 Enters the state of being set that its name is "state".
 
void BindToUI ()
 State machine will attach to Toggles, Buttons and Dropdowns.
 
void BindToUI (SGameObject go)
 State machine will bind to the gameobject "go".
 
- Public Member Functions inherited from ScriptClassWrapper< T >
override void Initialise (SScript runtime, object wrapper)
 
- Public Member Functions inherited from ScriptClass
void ReportError (string error, bool fatal, UnityEngine.Object target=null)
 
void Initialise (SScript runtime, object wrapper)
 

Properties

bool Enabled [get, set]
 Whether the simple state machine component is Enabled or not.
 
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.
 
string ComponentName [get]
 Return the component name of the state machine.
 
int StateCount [get]
 Return the count of states.
 
string[] StateNames [get]
 Return a list of names of states.
 
int CurrentState [get]
 Return the index number of the current state.
 
string CurrentStateName [get]
 Return the name of the current state, or null if no state.
 
- Properties inherited from ScriptClassComponent< T >
SGameObject GameObject [get]
 Return the GameObject which component added.
 
- Properties inherited from ScriptClass< T >
override bool Alive [get]
 Return if the component is alive.
 
- Properties inherited from ScriptClassWrapper< T >
_wrap [get]
 
- Properties inherited from ScriptClass
virtual bool Alive [get]
 
DynValue CachedData [get, set]
 

Additional Inherited Members

- Protected Member Functions inherited from ScriptClass
void Initialise (SScript runtime)
 

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
void BindToUI()
State machine will attach to Toggles, Buttons and Dropdowns.
Definition SStateMachine.cs:225

◆ 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
int CurrentState
Return the index number of the current state.
Definition SStateMachine.cs:107

◆ 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
void NextState()
Enter the next state.
Definition SStateMachine.cs:143

◆ 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
void PrevState()
Enter the previous state.
Definition SStateMachine.cs:164

◆ 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
void SetState(int state)
Enters the state of being set that its order is "state".
Definition SStateMachine.cs:186
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