Drag[en]gine Script Module DragonScript  1.23
Dragengine.BehaviorTreeSystem.BTRuleAction Class Reference

Behavior tree rule running an action. More...

Inheritance diagram for Dragengine.BehaviorTreeSystem.BTRuleAction:
Dragengine.BehaviorTreeSystem.BTRule

Public Member Functions

BTAction getAction ()
 
String getActionID ()
 Action identifier. More...
 
BTRuleAction new (String id, String actionID)
 Create behavior tree rule. More...
 
BTResult run (BTContext context)
 Run action. More...
 
String toString ()
 
- Public Member Functions inherited from Dragengine.BehaviorTreeSystem.BTRule
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

String pActionID
 
- Public Attributes inherited from Dragengine.BehaviorTreeSystem.BTRule
ConditionMode pConditionMode
 
Array pConditions
 
String pID
 
Dictionary pParameters
 
WeakReference pParent
 

Detailed Description

Behavior tree rule running an action.

This is the main working rule connecting game logic to the behavior tree. BTAction subclasses are created by the game developer and added to the behavior tree. If the rule is run the action is looked up and run. The return value of the action becomes the return value of the rule.

For performance reasons the action is looked up once then stored in the rule. This is correct behavior as long as the rules are not changed at run-time. If you need changing actions at run-time implement a BTAction forwarding to the desired BTAction. This way the cached action stays valid while the actual BTAction called inside can change. This is though an elaborate situation. Usually actions are added to the behavior tree once and then never change.

Member Function Documentation

◆ getAction()

BTAction Dragengine.BehaviorTreeSystem.BTRuleAction.getAction ( )
Deprecated:
Removed without replacement.

◆ getActionID()

String Dragengine.BehaviorTreeSystem.BTRuleAction.getActionID ( )

Action identifier.

◆ new()

BTRuleAction Dragengine.BehaviorTreeSystem.BTRuleAction.new ( String  id,
String  actionID 
)

Create behavior tree rule.

◆ run()

BTResult Dragengine.BehaviorTreeSystem.BTRuleAction.run ( BTContext  context)

Run action.

Returns
Action return value if no rule condition evaluates to false and the named action is found in the BTContext. Otherwise BTResult.failure is returned.

◆ toString()

String Dragengine.BehaviorTreeSystem.BTRuleAction.toString ( )

String representation of object.

Member Data Documentation

◆ pActionID

String Dragengine.BehaviorTreeSystem.BTRuleAction.pActionID

The documentation for this class was generated from the following file: