Class StateMachineController
A high level wrapper class that encapsulates a list of StateMachine
s and drives the active state of each
sub object according to a given list index that represents a state.
Inherited Members
Namespace: ScriptableFramework
Assembly: cs.temp.dll.dll
Syntax
public class StateMachineController : StateMachineBase
Fields
subStateMachines
A list of StateMachines that represent the current object state. The order of the objects is expected to match the order of the states.
Declaration
public List<StateMachineBase> subStateMachines
Field Value
Type | Description |
---|---|
List<StateMachineBase> |
Methods
ApplyState(Boolean)
Actually runs the loop which sets each object's state on or off.
Declaration
protected override void ApplyState(bool stateForAll)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | stateForAll | The new state for all objects. |
Overrides
ApplyState(Int32)
Actually runs the loop which sets each object's state on or off.
Declaration
protected override void ApplyState(int newSelectionIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | newSelectionIndex | Index of the state to be active. |
Overrides
ApplyState(Int32, Boolean)
Actually applies the new state to the selected object.
Declaration
protected override 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. |
Overrides
ApplyState(Int32, Int32, Boolean)
Actually runs the loop which applies your given range of objects and the rest with another.
Declaration
protected override 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. |
Overrides
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 override bool CheckListBeforeUpdate()
Returns
Type | Description |
---|---|
System.Boolean | If the list is null or not. |
Overrides
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 override 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. |
Overrides
CheckSelectionIndexBeforeUpdate(Int32)
Checks if the index is greater than -1 but less than the length of the list.
Declaration
protected override 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. |
Overrides
Clear()
If the list is not null, and has a count beyond 0, sets the current state according to defaultState
.
Declaration
public override void Clear()
Overrides
Reset()
Calls Clear ()
Declaration
public override void Reset()