Next revision | Previous revision |
dragengine:modules:dragonscript:behavior_statemachine [2020/09/13 15:59] – created dragonlord | dragengine:modules:dragonscript:behavior_statemachine [2024/03/14 16:43] (current) – dragonlord |
---|
</WRAP> | </WRAP> |
| |
Behavior element behavior adding [[https://developer.dragondreams.ch/docs/dragonscript/scriptapi/latest/classDragengine_1_1StateMachineSystem_1_1StateMachine.html|StateMachine]] support. | Behavior element behavior adding #@LinkApiDocDEDS2_HTML~classDragengine_1_1StateMachineSystem_1_1StateMachine.html,StateMachine~@# support. |
| |
Loads state machine from file (*.desm) and creates an [[https://developer.dragondreams.ch/docs/dragonscript/scriptapi/latest/classDragengine_1_1StateMachineSystem_1_1SMContext.html|SMContext]]. Other behaviors can add [[https://developer.dragondreams.ch/docs/dragonscript/scriptapi/latest/interfaceDragengine_1_1StateMachineSystem_1_1SMAction.html|actions]] and [[https://developer.dragondreams.ch/docs/dragonscript/scriptapi/latest/interfaceDragengine_1_1StateMachineSystem_1_1SMCondition.html|conditions]] to this state machine allowing to compose state machine actions and conditions easily. | Loads state machine from file (*.desm) and creates an #@LinkApiDocDEDS2_HTML~classDragengine_1_1StateMachineSystem_1_1SMContext.html,SMContext~@#. Other behaviors can add #@LinkApiDocDEDS2_HTML~interfaceDragengine_1_1StateMachineSystem_1_1SMAction.html,actions~@# and #@LinkApiDocDEDS2_HTML~interfaceDragengine_1_1StateMachineSystem_1_1SMCondition.html,conditions~@# to this state machine allowing to compose state machine actions and conditions easily. |
| |
This behavior can be used in different ways depending on the needs. | This behavior can be used in different ways depending on the needs. |
**Action and Condition Factory** | **Action and Condition Factory** |
| |
You can assign [[https://developer.dragondreams.ch/docs/dragonscript/scriptapi/latest/interfaceDragengine_1_1StateMachineSystem_1_1SMAction.html|actions]] and [[https://developer.dragondreams.ch/docs/dragonscript/scriptapi/latest/interfaceDragengine_1_1StateMachineSystem_1_1SMCondition.html|conditions]] without using other behaviors by using one or more [[https://developer.dragondreams.ch/docs/dragonscript/scriptapi/latest/interfaceDragengine_1_1Scenery_1_1ECBehaviorStateMachine_1_1ActionConditionFactory.html|Action/Condition Factories]]. The factories are added to the behavior. Upon creating the behavior instances the factories are asked to create and assign [[https://developer.dragondreams.ch/docs/dragonscript/scriptapi/latest/interfaceDragengine_1_1StateMachineSystem_1_1SMAction.html|SMAction]] and [[https://developer.dragondreams.ch/docs/dragonscript/scriptapi/latest/interfaceDragengine_1_1StateMachineSystem_1_1SMCondition.html|SMCondition]]. | You can assign #@LinkApiDocDEDS2_HTML~interfaceDragengine_1_1StateMachineSystem_1_1SMAction.html,actions~@# and #@LinkApiDocDEDS2_HTML~interfaceDragengine_1_1StateMachineSystem_1_1SMCondition.html,conditions~@# without using other behaviors by using one or more #@LinkApiDocDEDS2_HTML~interfaceDragengine_1_1Scenery_1_1ECBehaviorStateMachine_1_1ActionConditionFactory.html,Action/Condition Factories~@#. The factories are added to the behavior. Upon creating the behavior instances the factories are asked to create and assign #@LinkApiDocDEDS2_HTML~interfaceDragengine_1_1StateMachineSystem_1_1SMAction.html,SMAction~@# and #@LinkApiDocDEDS2_HTML~interfaceDragengine_1_1StateMachineSystem_1_1SMCondition.html,SMCondition~@#. |
| |
The example below shows how to use a factory to add a condition checking for a trigger and an action manipulating a trigger. | The example below shows how to use a factory to add a condition checking for a trigger and an action manipulating a trigger. |
====== Persistency ====== | ====== Persistency ====== |
| |
This behavior does support element class to be persistable (setPersistable). Saves state machine content ([[https://developer.dragondreams.ch/docs/dragonscript/scriptapi/latest/classDragengine_1_1StateMachineSystem_1_1SMContext.html|SMContext]]). | This behavior does support element class to be persistable (setPersistable). Saves state machine content (#@LinkApiDocDEDS2_HTML~classDragengine_1_1StateMachineSystem_1_1SMContext.html,SMContext~@#). |
| |
====== API Documentation ====== | ====== API Documentation ====== |
| |
[[https://developer.dragondreams.ch/docs/dragonscript/scriptapi/latest/classDragengine_1_1Scenery_1_1ECBehaviorStateMachine.html|ECBehaviorStateMachine]]. | #@LinkApiDocDEDS2_HTML~classDragengine_1_1Scenery_1_1ECBehaviorStateMachine.html,ECBehaviorStateMachine~@#. |
| |
Since DragonScript Module Version **1.3** | Since DragonScript Module Version **1.3** |