Drag[en]gine Script Module DragonScript  1.21
Dragengine.BehaviorTreeSystem.BTRule Class Reference

Behavior tree rule. More...

Inheritance diagram for Dragengine.BehaviorTreeSystem.BTRule:
Dragengine.BehaviorTreeSystem.BTRuleAction Dragengine.BehaviorTreeSystem.BTRuleFailure Dragengine.BehaviorTreeSystem.BTRuleList Dragengine.BehaviorTreeSystem.BTRuleRunning Dragengine.BehaviorTreeSystem.BTRuleSuccess Dragengine.BehaviorTreeSystem.BTRuleChoice Dragengine.BehaviorTreeSystem.BTRuleSequence

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
 

Detailed Description

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 .

Member Function Documentation

◆ addCondition()

void Dragengine.BehaviorTreeSystem.BTRule.addCondition ( String  condition)

Add condition.

◆ evaluateConditions()

bool Dragengine.BehaviorTreeSystem.BTRule.evaluateConditions ( BTContext  context)

Evaluate all conditions.

If no condition is present true is returned.

Parameters
parametersDictionary with parameters of type String key and String value. Do not change the content of the dictionary as it is shared.

◆ findCondition()

String Dragengine.BehaviorTreeSystem.BTRule.findCondition ( Block  ablock)

Find condition with block with parameter String.

◆ forEachCondition()

void Dragengine.BehaviorTreeSystem.BTRule.forEachCondition ( Block  ablock)

Visit conditions with block with parameter String.

◆ getConditionAt()

String Dragengine.BehaviorTreeSystem.BTRule.getConditionAt ( int  index)

Get condition at index.

◆ getConditionCount()

int Dragengine.BehaviorTreeSystem.BTRule.getConditionCount ( )

Number of conditions.

◆ getConditionMode()

ConditionMode Dragengine.BehaviorTreeSystem.BTRule.getConditionMode ( )

Condition mode from eConditionModes.

◆ getID()

String Dragengine.BehaviorTreeSystem.BTRule.getID ( )

Unique rule identifier or null.

◆ getParameters()

Dictionary Dragengine.BehaviorTreeSystem.BTRule.getParameters ( )

Parameters as Dictionary of type String key and String value.

Warning
Do not change the content of the dictionary as it is shared.

◆ getParent()

BTRule Dragengine.BehaviorTreeSystem.BTRule.getParent ( )

Parent rule or null if this is the root rule in a behavior tree.

◆ indexOfCondition()

int Dragengine.BehaviorTreeSystem.BTRule.indexOfCondition ( String  condition)

Index of condition or -1 if absent.

◆ new()

BTRule Dragengine.BehaviorTreeSystem.BTRule.new ( String  id)

◆ removeAllConditions()

void Dragengine.BehaviorTreeSystem.BTRule.removeAllConditions ( )

Remove all conditions.

◆ removeCondition()

void Dragengine.BehaviorTreeSystem.BTRule.removeCondition ( String  condition)

Remove condition.

◆ setConditionMode()

void Dragengine.BehaviorTreeSystem.BTRule.setConditionMode ( ConditionMode  mode)

Set condition mode from eConditionModes.

◆ setParent()

void Dragengine.BehaviorTreeSystem.BTRule.setParent ( BTRule  rule)

Set parent rule or null if this is the root rule in a behavior tree.

Member Data Documentation

◆ pConditionMode

ConditionMode Dragengine.BehaviorTreeSystem.BTRule.pConditionMode

◆ pConditions

Array Dragengine.BehaviorTreeSystem.BTRule.pConditions

◆ pID

String Dragengine.BehaviorTreeSystem.BTRule.pID

◆ pParameters

Dictionary Dragengine.BehaviorTreeSystem.BTRule.pParameters

◆ pParent

WeakReference Dragengine.BehaviorTreeSystem.BTRule.pParent

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