Keeps a mapping of IDs to template BehaviorTree nodes. More...
#include <NodeMapper.h>
Public Member Functions | |
void | Register (const UBTTaskNode *node) |
void | Register (const UBTCompositeNode *node) |
void | Register (const UBTService *node) |
void | Register (const UBTDecorator *node) |
bool | TryGetMapping (const UBTNode *node, FNodeMapID &result) const |
Tries to retrieve a mapped ID for the give node. More... | |
bool | TryGetTemplate (FNodeMapID mapping, UBTNode *&result) const |
Tries to retrieve the template node for a given Map ID. More... | |
FNodeMapID | GetOrAddMapping (const UBTCompositeNode *node) |
Retrieve a mapped ID for the given node, adding it if it did not exist. More... | |
FNodeMapID | GetOrAddMapping (const UBTTaskNode *node) |
Retrieve a mapped ID for the given node, adding it if it did not exist. More... | |
FNodeMapID | GetOrAddMapping (const UBTService *node) |
Retrieve a mapped ID for the given node, adding it if it did not exist. More... | |
FNodeMapID | GetOrAddMapping (const UBTDecorator *node) |
Retrieve a mapped ID for the given node, adding it if it did not exist. More... | |
FNodeMapID | GetRandomCompositeID (URandomGen *randomGen) |
FNodeMapID | GetRandomTaskID (URandomGen *randomGen) |
FNodeMapID | GetRandomServiceID (URandomGen *randomGen) |
FNodeMapID | GetRandomDecoratorID (URandomGen *randomGen) |
Public Member Functions inherited from UService | |
virtual void | Init (UServiceInjector *injector) |
Protected Member Functions | |
void | Reset (UBTNode *node) |
void | AddMapping (UBTNode *node, FNodeMapID nodeID) |
Add the given node as a Template, creating a new mapping. More... | |
Additional Inherited Members | |
Protected Attributes inherited from UService | |
UServiceInjector * | serviceInjector |
Keeps a mapping of IDs to template BehaviorTree nodes.
The NodeMapper stores a map of FNodeMapID to UBTNode. Each Node should be thought of as the template for creating new nodes with the same variables and type.
When you map a node, its ID must be unique. Currently, IDs are the node name. Therefore, you should always name your nodes uniquely.
When you retrieve nodes from the NodeMapper, it returns the template directly. You should then copy the template, not modify it.
|
protected |
Add the given node as a Template, creating a new mapping.
node | The node to add. |
The node ID must be unique. At the moment, the ID is just the Node Name.
FNodeMapID UNodeMapper::GetOrAddMapping | ( | const UBTCompositeNode * | node | ) |
Retrieve a mapped ID for the given node, adding it if it did not exist.
node | The node to map. |
FNodeMapID UNodeMapper::GetOrAddMapping | ( | const UBTDecorator * | node | ) |
Retrieve a mapped ID for the given node, adding it if it did not exist.
node | The node to map. |
FNodeMapID UNodeMapper::GetOrAddMapping | ( | const UBTService * | node | ) |
Retrieve a mapped ID for the given node, adding it if it did not exist.
node | The node to map. |
FNodeMapID UNodeMapper::GetOrAddMapping | ( | const UBTTaskNode * | node | ) |
Retrieve a mapped ID for the given node, adding it if it did not exist.
node | The node to map. |
bool UNodeMapper::TryGetMapping | ( | const UBTNode * | node, |
FNodeMapID & | result | ||
) | const |
Tries to retrieve a mapped ID for the give node.
node | The template node to retrieve. |
result | The mapped ID, if found. |
bool UNodeMapper::TryGetTemplate | ( | FNodeMapID | mapping, |
UBTNode *& | result | ||
) | const |
Tries to retrieve the template node for a given Map ID.
mapping | The Mapped ID to retrieve. |
result | The resulting template node, if found. |
You should not modify the resulting template node - you should copy it.