Class StateMachineBase
Namespace: ScriptableFramework
Assembly: cs.temp.dll.dll
Syntax
public abstract class StateMachineBase : RuntimeObject
Fields
defaultState
A enum to determine how the Clear ()
and Reset ()
functions behave.
Declaration
public DefaultState defaultState
Field Value
Type | Description |
---|---|
DefaultState |
selectionIndex
The current index of the state machine. Default value is 0. When Clear ()
is called and
defaultState
is not set to first active, will be set to -1.
Declaration
public int selectionIndex
Field Value
Type | Description |
---|---|
System.Int32 |
Methods
ApplyState(Boolean)
Actually runs the loop which sets the state of all objects in the list.
Declaration
protected abstract void ApplyState(bool stateForAll)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | stateForAll | State to apply for all. |
ApplyState(Int32)
Actually runs the loop which updates the state.
Declaration
protected abstract void ApplyState(int newSelectionIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | newSelectionIndex | Index of the state to be active. |
ApplyState(Int32, Boolean)
Actually applies the new state to the selected object.
Declaration
protected abstract void ApplyState(int newSelectionIndex, bool stateAtThisObject)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | newSelectionIndex | The index of the object to update. |
System.Boolean | stateAtThisObject | The state to provide that object with. |
ApplyState(Int32, Int32, Boolean)
Actually runs the loop which applies your given range of objects and the rest with another.
Declaration
protected abstract void ApplyState(int startIndex, int length, bool stateToApply)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | startIndex | Where to start applying your state (inclusive). |
System.Int32 | length | How many objects to affect. |
System.Boolean | stateToApply | The state to apply within your given range. |
CheckListBeforeUpdate()
Checks if the list is null. Since the list can be a varying type, defining this as an abstract function is needed to help reduce code.
Declaration
protected abstract bool CheckListBeforeUpdate()
Returns
Type | Description |
---|---|
System.Boolean | If the list is null or not. |
CheckListItemBeforeUpdate(Int32)
Checks if an item in the list is null. Since the list can be a varying type, defining this as an abstract function is needed to help reduce code.
Declaration
protected abstract bool CheckListItemBeforeUpdate(int objectIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | objectIndex | The index of the object to check. |
Returns
Type | Description |
---|---|
System.Boolean | If the item is null or not. |
CheckSelectionIndexBeforeUpdate(Int32)
Checks if the index is greater than -1 but less than the length of the list.
Declaration
protected abstract bool CheckSelectionIndexBeforeUpdate(int objectIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | objectIndex | The index of the object to check. |
Returns
Type | Description |
---|---|
System.Boolean | True if the index is within a range that won't throw an out of range exception. |
UpdateState(Boolean)
Applies the same state to all objects in the current list.
Declaration
public void UpdateState(bool stateForAll)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | stateForAll | The new state for all contained object. |
UpdateState(Int32)
Applies a new single state to the list.
Declaration
public void UpdateState(int newSelectionIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | newSelectionIndex | Index of the state to be active. |
UpdateState(Int32, Boolean)
Applies a state to a single object without affecting other objects in the list.
Declaration
public void UpdateState(int newSelectionIndex, bool stateAtThisObject)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | newSelectionIndex | The index of the object to update. |
System.Boolean | stateAtThisObject | The state to provide that object with. |
UpdateState(Int32, Int32, Boolean)
Applies a state to all objects in the given range and the opposite state to the objects outside of the range.
Declaration
public void UpdateState(int startIndex, int length, bool stateToApply)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | startIndex | Where to start applying your state (inclusive). |
System.Int32 | length | How many objects to affect. |
System.Boolean | stateToApply | The state to apply within your given range. |