Drag[en]gine Script Module DragonScript 1.35
Loading...
Searching...
No Matches
Dragengine.BehaviorTreeSystem.BTRuleAction Class Reference

Behavior tree rule running an action. More...

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

Public Member Functions

BTAction getAction ()
String getActionID ()
 Action identifier.
bool getDoNotFail ()
 Return success if action fails.
BTRuleAction new (String id, String actionID)
 Create behavior tree rule.
BTResult run (BTContext context)
 Run action.
void setDoNotFail (bool doNotFail)
 Set to return success if action fails.
String toString ()
Public Member Functions inherited from Dragengine.BehaviorTreeSystem.BTRule
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.
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 pActionID
bool pDoNoFail
Public Attributes inherited from Dragengine.BehaviorTreeSystem.BTRule
String pID
WeakReference pParent
Public Attributes inherited from Dragengine.BehaviorTreeSystem.BTConditionGroup
BTRule.ConditionMode pConditionMode
Array pConditions
Dictionary pParameters

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.

References getActionID(), and pActionID.

Referenced by getDoNotFail(), and toString().

◆ getActionID()

String Dragengine.BehaviorTreeSystem.BTRuleAction.getActionID ( )

Action identifier.

Referenced by getAction().

◆ getDoNotFail()

bool Dragengine.BehaviorTreeSystem.BTRuleAction.getDoNotFail ( )

Return success if action fails.

Version
1.26

References getAction().

Referenced by setDoNotFail().

◆ new()

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

Create behavior tree rule.

References new(), and pActionID.

Referenced by new().

◆ 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.

Reimplemented from Dragengine.BehaviorTreeSystem.BTRule.

References pDoNoFail, and setDoNotFail().

Referenced by toString().

◆ setDoNotFail()

void Dragengine.BehaviorTreeSystem.BTRuleAction.setDoNotFail ( bool doNotFail)

Set to return success if action fails.

Version
1.26

References getDoNotFail(), and pDoNoFail.

Referenced by run().

◆ toString()

String Dragengine.BehaviorTreeSystem.BTRuleAction.toString ( )

String representation of object.

References Dragengine.BehaviorTreeSystem.BTConditionGroup.evaluateConditions(), getAction(), pDoNoFail, run(), and toString().

Referenced by toString().

Member Data Documentation

◆ pActionID

String Dragengine.BehaviorTreeSystem.BTRuleAction.pActionID

Referenced by getAction(), and new().

◆ pDoNoFail

bool Dragengine.BehaviorTreeSystem.BTRuleAction.pDoNoFail

Referenced by run(), setDoNotFail(), and toString().


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