|
Drag[en]gine Script Module DragonScript 1.35
|
Behavior tree rule. More...
Classes | |
| enum | ConditionMode |
| Condition modes. More... | |
Public Member Functions | |
| String | getID () |
| Unique rule identifier or null. | |
| BTRule | getParent () |
| Parent rule or null if this is the root rule in a behavior tree. | |
| BTRule | new (String id) |
| Create behavior tree rule. | |
| BTResult | run (BTContext context) |
| Run rule. | |
| void | setParent (BTRule rule) |
| Set parent rule or null if this is the root rule in a behavior tree. | |
| Public Member Functions inherited from Dragengine.BehaviorTreeSystem.BTConditionGroup | |
| void | addCondition (String condition) |
| Add condition. | |
| void | addConditionGroup (BTConditionGroup group) |
| Add condition group. | |
| bool | evaluateConditions (BTContext context) |
| Evaluate all conditions. | |
| String | findCondition (Block ablock) |
| Find condition with block with parameter String. | |
| BTConditionGroup | findConditionGroup (Block ablock) |
| Find condition group with block with parameter BTConditionGroup. | |
| void | forEachCondition (Block ablock) |
| Visit conditions with block with parameter String. | |
| void | forEachConditionGroup (Block ablock) |
| Visit condition groups with block with parameter BTConditionGroup. | |
| String | getConditionAt (int index) |
| Get condition at index. | |
| int | getConditionCount () |
| Number of conditions. | |
| BTConditionGroup | getConditionGroupAt (int index) |
| Get condition group at index. | |
| int | getConditionGroupCount () |
| Count of condition groups. | |
| Array | getConditionGroups () |
| Get all condition groups as Array of BTConditionGroup. | |
| BTRule.ConditionMode | getConditionMode () |
| Condition mode from eConditionModes. | |
| Dictionary | getParameters () |
| Parameters as Dictionary of String key and String value. | |
| int | indexOfCondition (String condition) |
| Index of condition or -1 if absent. | |
| BTConditionGroup | new () |
| Create behavior tree condition group. | |
| void | removeAllConditions () |
| Remove all conditions. | |
| void | removeCondition (String condition) |
| Remove condition. | |
| void | setConditionMode (BTRule.ConditionMode mode) |
| Set condition mode from eConditionModes. | |
Public Attributes | |
| String | pID |
| WeakReference | pParent |
| Public Attributes inherited from Dragengine.BehaviorTreeSystem.BTConditionGroup | |
| BTRule.ConditionMode | pConditionMode |
| Array | pConditions |
| Dictionary | pParameters |
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 .
| String Dragengine.BehaviorTreeSystem.BTRule.getID | ( | ) |
| BTRule Dragengine.BehaviorTreeSystem.BTRule.getParent | ( | ) |
Parent rule or null if this is the root rule in a behavior tree.
Referenced by Dragengine.BehaviorTreeSystem.BTRuleList.forEach(), and setParent().
| BTRule Dragengine.BehaviorTreeSystem.BTRule.new | ( | String | id | ) |
Create behavior tree rule.
| id | Identifier or null. |
| EInvalidParam | id is empty string. |
Reimplemented in Dragengine.BehaviorTreeSystem.BTRuleChoice, Dragengine.BehaviorTreeSystem.BTRuleFailure, Dragengine.BehaviorTreeSystem.BTRuleList, Dragengine.BehaviorTreeSystem.BTRuleRunning, Dragengine.BehaviorTreeSystem.BTRuleSequence, Dragengine.BehaviorTreeSystem.BTRuleSuccess, and Dragengine.BehaviorTreeSystem.BTRuleYield.
References new().
| BTResult Dragengine.BehaviorTreeSystem.BTRule.run | ( | BTContext | context | ) |
Run rule.
Reimplemented in Dragengine.BehaviorTreeSystem.BTRuleAction, Dragengine.BehaviorTreeSystem.BTRuleChoice, Dragengine.BehaviorTreeSystem.BTRuleFailure, Dragengine.BehaviorTreeSystem.BTRuleRunning, Dragengine.BehaviorTreeSystem.BTRuleSequence, Dragengine.BehaviorTreeSystem.BTRuleSuccess, and Dragengine.BehaviorTreeSystem.BTRuleYield.
References pParent, run(), and setParent().
Referenced by run().
| void Dragengine.BehaviorTreeSystem.BTRule.setParent | ( | BTRule | rule | ) |
Set parent rule or null if this is the root rule in a behavior tree.
References getID(), getParent(), pID, and pParent.
Referenced by Dragengine.BehaviorTreeSystem.BTRuleList.find(), and run().
| String Dragengine.BehaviorTreeSystem.BTRule.pID |
Referenced by getID(), and setParent().
| WeakReference Dragengine.BehaviorTreeSystem.BTRule.pParent |
Referenced by getID(), run(), and setParent().