|
Drag[en]gine Script Module DragonScript 1.35
|
Helper class supporting both behavior tree and state machine actions and conditions. More...
Public Member Functions | |
| bool | evaluateCondition (BTContext context, Dictionary parameters) |
| Evaluate condition. | |
| bool | evaluateCondition (SMContext context, Dictionary parameters) |
| Evaluate condition. | |
| bool | evaluateConditionShared (Object context, Dictionary parameters) |
| Evaluate condition. | |
| BTSMActionCondition | new () |
| Create shared behavior tree and state machine action and condition. | |
| BTResult | runAction (BTContext context, Dictionary parameters) |
| Run action. | |
| void | runAction (SMContext context, Dictionary parameters) |
| Run action. | |
| BTResult | runActionShared (Object context, Dictionary parameters) |
| Run action shared. | |
Helper class supporting both behavior tree and state machine actions and conditions.
This class is useful to use the same set of actions and conditions for both behavior trees and state machines. State machine actions throw an exception if the shared action returns BTResult#failure.
To use actions overwrite BTSMActionCondition.runActionShared(). To use conditions overwrite BTSMActionCondition.evaluateConditionShared().
Typical usage looks like this (inside an Scenery.DefaultECBehaviorInstance subclass):
And adding it to ECComposeBTSM.Instance like this (in Scenery.DefaultECBehaviorInstance.init()):
| bool Dragengine.Utils.BTSMActionCondition.evaluateCondition | ( | BTContext | context, |
| Dictionary | parameters ) |
Evaluate condition.
| parameters | Dictionary with parameters of type String key and String value. Do not change the content of the dictionary as it is shared. |
Implements Dragengine.BehaviorTreeSystem.BTCondition.
References runAction().
Referenced by evaluateCondition().
| bool Dragengine.Utils.BTSMActionCondition.evaluateCondition | ( | SMContext | context, |
| Dictionary | parameters ) |
Evaluate condition.
| parameters | Dictionary with parameters of type String key and String value. Do not change the content of the dictionary as it is shared. |
Implements Dragengine.StateMachineSystem.SMCondition.
References evaluateCondition(), evaluateConditionShared(), new(), runAction(), and runActionShared().
| bool Dragengine.Utils.BTSMActionCondition.evaluateConditionShared | ( | Object | context, |
| Dictionary | parameters ) |
Evaluate condition.
Context which can be either BTContext or SMContext.
Default implementation returns false.
Reimplemented in Dragengine.Utils.BTSMCondition.
Referenced by evaluateCondition(), Dragengine.Scenery.ECBehaviorInteractionElement.Instance.BTAUpdate.CCInteract.evaluateQuery(), and runAction().
| BTSMActionCondition Dragengine.Utils.BTSMActionCondition.new | ( | ) |
Create shared behavior tree and state machine action and condition.
References new().
Referenced by evaluateCondition(), and new().
| BTResult Dragengine.Utils.BTSMActionCondition.runAction | ( | BTContext | context, |
| Dictionary | parameters ) |
Run action.
| parameters | Dictionary with parameters of type String key and String value. Do not change the content of the dictionary as it is shared. |
Implements Dragengine.BehaviorTreeSystem.BTAction.
References evaluateConditionShared().
Referenced by evaluateCondition(), and evaluateCondition().
| void Dragengine.Utils.BTSMActionCondition.runAction | ( | SMContext | context, |
| Dictionary | parameters ) |
Run action.
| parameters | Dictionary with parameters of type String key and String value. Do not change the content of the dictionary as it is shared. |
Implements Dragengine.StateMachineSystem.SMAction.
| BTResult Dragengine.Utils.BTSMActionCondition.runActionShared | ( | Object | context, |
| Dictionary | parameters ) |
Run action shared.
For state machine use exception is thrown if the returned value is BTResult#failure. Default implementation returns BTResult#failure.
Context which can be either BTContext or SMContext.
Reimplemented in Dragengine.Utils.BTSMCondition.
References runActionShared().
Referenced by evaluateCondition(), and runActionShared().