Drag[en]gine Script Module DragonScript
1.23
|
Behavior tree rule. More...
Classes | |
enum | ConditionMode |
Condition modes. More... | |
Public Member Functions | |
void | addCondition (String condition) |
Add condition. More... | |
bool | evaluateConditions (BTContext context) |
Evaluate all conditions. More... | |
String | findCondition (Block ablock) |
Find condition with block with parameter String. More... | |
void | forEachCondition (Block ablock) |
Visit conditions with block with parameter String. More... | |
String | getConditionAt (int index) |
Get condition at index. More... | |
int | getConditionCount () |
Number of conditions. More... | |
ConditionMode | getConditionMode () |
Condition mode from eConditionModes. More... | |
String | getID () |
Unique rule identifier or null. More... | |
Dictionary | getParameters () |
Parameters as Dictionary of type String key and String value. More... | |
BTRule | getParent () |
Parent rule or null if this is the root rule in a behavior tree. More... | |
int | indexOfCondition (String condition) |
Index of condition or -1 if absent. More... | |
BTRule | new (String id) |
Create behavior tree rule. More... | |
void | removeAllConditions () |
Remove all conditions. More... | |
void | removeCondition (String condition) |
Remove condition. More... | |
void | setConditionMode (ConditionMode mode) |
Set condition mode from eConditionModes. More... | |
void | setParent (BTRule rule) |
Set parent rule or null if this is the root rule in a behavior tree. More... | |
Public Attributes | |
ConditionMode | pConditionMode |
Array | pConditions |
String | pID |
Dictionary | pParameters |
WeakReference | pParent |
Behavior tree rule.
Rules defines the behavior of the behavior tree. They can call BTActions to do game specific actions. Both rules and actions use the same return value.
Rules are assigned a unique identifier. This identifier can be saved to restore the behavior tree state later on. Strings are used instead of a number to make the behavior tree more portable across changing save state revisions.
Rules can be further befitted with conditions. The rule is only run if all conditions evaluate to true. This allows to prevent rules from being run or to interrupt a running rule. If the condition is false the rule is considered to return BTResult.failure .
void Dragengine.BehaviorTreeSystem.BTRule.addCondition | ( | String | condition | ) |
Add condition.
bool Dragengine.BehaviorTreeSystem.BTRule.evaluateConditions | ( | BTContext | context | ) |
Evaluate all conditions.
If no condition is present true is returned.
parameters | Dictionary with parameters of type String key and String value. Do not change the content of the dictionary as it is shared. |
String Dragengine.BehaviorTreeSystem.BTRule.findCondition | ( | Block | ablock | ) |
Find condition with block with parameter String.
void Dragengine.BehaviorTreeSystem.BTRule.forEachCondition | ( | Block | ablock | ) |
Visit conditions with block with parameter String.
String Dragengine.BehaviorTreeSystem.BTRule.getConditionAt | ( | int | index | ) |
Get condition at index.
int Dragengine.BehaviorTreeSystem.BTRule.getConditionCount | ( | ) |
Number of conditions.
ConditionMode Dragengine.BehaviorTreeSystem.BTRule.getConditionMode | ( | ) |
Condition mode from eConditionModes.
String Dragengine.BehaviorTreeSystem.BTRule.getID | ( | ) |
Unique rule identifier or null.
Dictionary Dragengine.BehaviorTreeSystem.BTRule.getParameters | ( | ) |
Parameters as Dictionary of type String key and String value.
BTRule Dragengine.BehaviorTreeSystem.BTRule.getParent | ( | ) |
Parent rule or null if this is the root rule in a behavior tree.
int Dragengine.BehaviorTreeSystem.BTRule.indexOfCondition | ( | String | condition | ) |
Index of condition or -1 if absent.
BTRule Dragengine.BehaviorTreeSystem.BTRule.new | ( | String | id | ) |
Create behavior tree rule.
id | Identifier or null. |
EInvalidParam | id is empty string. |
Reimplemented in Dragengine.BehaviorTreeSystem.BTRuleSuccess, Dragengine.BehaviorTreeSystem.BTRuleSequence, Dragengine.BehaviorTreeSystem.BTRuleRunning, Dragengine.BehaviorTreeSystem.BTRuleList, Dragengine.BehaviorTreeSystem.BTRuleFailure, and Dragengine.BehaviorTreeSystem.BTRuleChoice.
void Dragengine.BehaviorTreeSystem.BTRule.removeAllConditions | ( | ) |
Remove all conditions.
void Dragengine.BehaviorTreeSystem.BTRule.removeCondition | ( | String | condition | ) |
Remove condition.
void Dragengine.BehaviorTreeSystem.BTRule.setConditionMode | ( | ConditionMode | mode | ) |
Set condition mode from eConditionModes.
void Dragengine.BehaviorTreeSystem.BTRule.setParent | ( | BTRule | rule | ) |
Set parent rule or null if this is the root rule in a behavior tree.
ConditionMode Dragengine.BehaviorTreeSystem.BTRule.pConditionMode |
Array Dragengine.BehaviorTreeSystem.BTRule.pConditions |
String Dragengine.BehaviorTreeSystem.BTRule.pID |
Dictionary Dragengine.BehaviorTreeSystem.BTRule.pParameters |
WeakReference Dragengine.BehaviorTreeSystem.BTRule.pParent |