BehaviorTree
Core Library to create and execute Behavior Trees
Loading...
Searching...
No Matches
BT::details Namespace Reference

The SwitchNode is equivalent to a switch statement, where a certain branch (child) is executed according to the value of a blackboard entry. More...

Classes

class  Semaphore
 

Functions

template<typename T = AnyTypeAllowed, typename DefaultT = T>
std::pair< std::string, PortInfoPortWithDefault (PortDirection direction, StringView name, const DefaultT &default_value, StringView description)
 
bool CheckStringEquality (const std::string &v1, const std::string &v2, const ScriptingEnumsRegistry *enums)
 

Detailed Description

The SwitchNode is equivalent to a switch statement, where a certain branch (child) is executed according to the value of a blackboard entry.

Note that the same behaviour can be achieved with multiple Sequences, Fallbacks and Conditions reading the blackboard, but switch is shorter and more readable.

Example usage:

<Switch3 variable="{var}" case_1="1" case_2="42" case_3="666" > </Switch3>

When the SwitchNode is executed (Switch3 is a node with 3 cases) the "variable" will be compared to the cases and execute the correct child or the default one (last).