Space Engineers
|
Implementation of generic multistate state machine. Is able to run multiple independent cursors at once updated with every update call. Use cursors as access point to active states. More...
Public Member Functions | |
virtual MyStateMachineCursor | CreateCursor (string nodeName) |
Creates new active cursor. More... | |
MyStateMachineCursor | FindCursor (int cursorId) |
virtual bool | DeleteCursor (int id) |
virtual bool | AddNode (MyStateMachineNode newNode) |
MyStateMachineNode | FindNode (string nodeName) |
virtual bool | DeleteNode (string nodeName) |
virtual MyStateMachineTransition | AddTransition (string startNodeName, string endNodeName, MyStateMachineTransition existingInstance=null, string name=null) |
MyStateMachineTransition | FindTransition (int transitionId) |
MyStateMachineTransitionWithStart | FindTransitionWithStart (int transitionId) |
virtual bool | DeleteTransition (int transitionId) |
virtual bool | SetState (int cursorId, string nameOfNewState) |
Set the current state. Warning - this is not a thing that you would like to normally do, state machine should live its own life (based on transition condition). Returns true on success. More... | |
virtual void | Update () |
Update the state machine. Transition to new states. More... | |
void | TriggerAction (MyStringId actionName) |
Trigger an action in this layer. If there is a transition having given (non-null) name, it is followed immediatelly. Conditions of transition are ignored. More... | |
void | SortTransitions () |
Sort the transitions between states according to their priorities. More... | |
delegate void | StateChangedHandler (MyStateMachineTransitionWithStart transition) |
MyStateMachine () | |
bool | AddNode (MyStateMachineNode newNode) |
MyStateMachineNode | FindNode (string nodeName) |
bool | DeleteNode (string nodeName) |
MyStateMachineTransition | AddTransition (string startNodeName, string endNodeName, MyStateMachineTransition existingInstance=null) |
MyStateMachineTransition | FindTransition (int transitionId) |
bool | DeleteTransition (int transitionId) |
virtual bool | SetState (string nameOfNewState) |
Set the current state. Warning - this is not a thing that you would like to normally do, state machine should live its own life (based on transition condition). Returns true on success. More... | |
void | Update () |
void | TriggerAction (MyStringId actionName) |
Trigger an action in this layer. If there is a transition having given (non-null) name, it is followed immediatelly. Conditions of transition are ignored. More... | |
void | SortTransitions () |
Sort the transitions between states according to their priorities. More... | |
Protected Member Functions | |
void | NotifyStateChanged (MyStateMachineTransitionWithStart transitionWithStart) |
Protected Attributes | |
Dictionary< string, MyStateMachineNode > | m_nodes = new Dictionary<string, MyStateMachineNode>() |
Dictionary< int, MyStateMachineTransitionWithStart > | m_transitions = new Dictionary<int, MyStateMachineTransitionWithStart>() |
Dictionary< int, MyStateMachineCursor > | m_activeCursorsById = new Dictionary<int, MyStateMachineCursor>() |
CachingList< MyStateMachineCursor > | m_activeCursors = new CachingList<MyStateMachineCursor>() |
MyConcurrentHashSet< MyStringId > | m_enqueuedActions = new MyConcurrentHashSet<MyStringId>() |
Properties | |
DictionaryReader< string, MyStateMachineNode > | AllNodes [get] |
List< MyStateMachineCursor > | ActiveCursors [get] |
string | Name [get, set] |
MyStateMachineNode | CurrentNode [get, protected set] |
Events | |
StateChangedHandler | OnStateChanged |
Implementation of generic multistate state machine. Is able to run multiple independent cursors at once updated with every update call. Use cursors as access point to active states.
Implementation of generic state machine. Inherit from this class to create your own state machine. Transitions are performed automatically on each update (if conditions of transition are fulfilled).
Definition at line 12 of file MyMultiStateMachine.cs.
|
inline |
Definition at line 47 of file MyStateMachine.cs.
|
inline |
Definition at line 57 of file MyStateMachine.cs.
|
inlinevirtual |
Definition at line 86 of file MyMultiStateMachine.cs.
|
inline |
Definition at line 104 of file MyStateMachine.cs.
|
inlinevirtual |
Definition at line 141 of file MyMultiStateMachine.cs.
|
inlinevirtual |
Creates new active cursor.
Reimplemented in VRage.Game.VisualScripting.Missions.MyVSStateMachine, and VRage.Generics.MySingleStateMachine.
Definition at line 46 of file MyMultiStateMachine.cs.
|
inlinevirtual |
Reimplemented in VRage.Generics.MySingleStateMachine.
Definition at line 69 of file MyMultiStateMachine.cs.
|
inline |
Definition at line 79 of file MyStateMachine.cs.
|
inlinevirtual |
Definition at line 108 of file MyMultiStateMachine.cs.
|
inline |
Definition at line 143 of file MyStateMachine.cs.
|
inlinevirtual |
Definition at line 192 of file MyMultiStateMachine.cs.
|
inline |
Definition at line 61 of file MyMultiStateMachine.cs.
|
inline |
Definition at line 71 of file MyStateMachine.cs.
|
inline |
Definition at line 100 of file MyMultiStateMachine.cs.
|
inline |
Definition at line 135 of file MyStateMachine.cs.
|
inline |
Definition at line 178 of file MyMultiStateMachine.cs.
|
inline |
Definition at line 184 of file MyMultiStateMachine.cs.
|
inlineprotected |
Definition at line 35 of file MyStateMachine.cs.
|
inlinevirtual |
Set the current state. Warning - this is not a thing that you would like to normally do, state machine should live its own life (based on transition condition). Returns true on success.
Reimplemented in VRage.Generics.MySingleStateMachine.
Definition at line 165 of file MyStateMachine.cs.
|
inlinevirtual |
Set the current state. Warning - this is not a thing that you would like to normally do, state machine should live its own life (based on transition condition). Returns true on success.
Definition at line 217 of file MyMultiStateMachine.cs.
|
inline |
Sort the transitions between states according to their priorities.
Definition at line 246 of file MyStateMachine.cs.
|
inline |
Sort the transitions between states according to their priorities.
Definition at line 263 of file MyMultiStateMachine.cs.
delegate void VRage.Generics.MyStateMachine.StateChangedHandler | ( | MyStateMachineTransitionWithStart | transition | ) |
|
inline |
Trigger an action in this layer. If there is a transition having given (non-null) name, it is followed immediatelly. Conditions of transition are ignored.
Definition at line 238 of file MyStateMachine.cs.
|
inline |
Trigger an action in this layer. If there is a transition having given (non-null) name, it is followed immediatelly. Conditions of transition are ignored.
Definition at line 255 of file MyMultiStateMachine.cs.
|
inline |
Definition at line 180 of file MyStateMachine.cs.
|
inlinevirtual |
Update the state machine. Transition to new states.
Reimplemented in VRage.Game.VisualScripting.Missions.MyVSStateMachine.
Definition at line 233 of file MyMultiStateMachine.cs.
|
protected |
Definition at line 23 of file MyMultiStateMachine.cs.
|
protected |
Definition at line 21 of file MyMultiStateMachine.cs.
|
protected |
Definition at line 25 of file MyMultiStateMachine.cs.
|
protected |
Definition at line 17 of file MyMultiStateMachine.cs.
|
protected |
Definition at line 19 of file MyMultiStateMachine.cs.
|
get |
Definition at line 36 of file MyMultiStateMachine.cs.
|
get |
Definition at line 29 of file MyMultiStateMachine.cs.
|
getprotected set |
Definition at line 44 of file MyStateMachine.cs.
|
getset |
Definition at line 41 of file MyMultiStateMachine.cs.
StateChangedHandler VRage.Generics.MyStateMachine.OnStateChanged |
Definition at line 34 of file MyStateMachine.cs.