Behavior Tree service nodes is designed to perform "background" tasks that update AI's knowledge. 更多...
#include <BTService.h>
类 UBTService 继承关系图:Protected 成员函数 | |
| virtual void | OnSearchStart (FBehaviorTreeSearchData &SearchData) |
| called when search enters underlying branch this function should be considered as const (don't modify state of object) if node is not instanced! | |
| virtual void | ScheduleNextTick (UBehaviorTreeComponent &OwnerComp, uint8 *NodeMemory) |
| set next tick time | |
| virtual void | TickNode (UBehaviorTreeComponent &OwnerComp, uint8 *NodeMemory, float DeltaSeconds) override |
| update next tick interval this function should be considered as const (don't modify state of object) if node is not instanced! | |
Protected 成员函数 继承自 UBTAuxiliaryNode | |
| float | GetNextTickRemainingTime (uint8 *NodeMemory) const |
| gets remaining time for next tick | |
| virtual void | OnBecomeRelevant (UBehaviorTreeComponent &OwnerComp, uint8 *NodeMemory) |
| called when auxiliary node becomes active this function should be considered as const (don't modify state of object) if node is not instanced! | |
| virtual void | OnCeaseRelevant (UBehaviorTreeComponent &OwnerComp, uint8 *NodeMemory) |
| called when auxiliary node becomes inactive this function should be considered as const (don't modify state of object) if node is not instanced! | |
| void | SetNextTickTime (uint8 *NodeMemory, float RemainingTime) const |
| sets next tick time | |
| virtual void | TickNode (UBehaviorTreeComponent &OwnerComp, uint8 *NodeMemory, float DeltaSeconds) |
| tick function this function should be considered as const (don't modify state of object) if node is not instanced! | |
Protected 属性 | |
| uint32 | bCallTickOnSearchStart: 1 |
| call Tick event when task search enters this node (SearchStart will be called as well) | |
| uint32 | bNotifyOnSearch: 1 |
| if set, service will be notified about search entering underlying branch | |
| uint32 | bRestartTimerOnEachActivation: 1 |
| if set, next tick time will be always reset to service's interval when node is activated | |
| float | Interval |
| defines time span between subsequent ticks of the service | |
| float | RandomDeviation |
| adds random range to service's Interval | |
Protected 属性 继承自 UBTAuxiliaryNode | |
| uint8 | bNotifyBecomeRelevant:1 |
| if set, OnBecomeRelevant will be used | |
| uint8 | bNotifyCeaseRelevant:1 |
| if set, OnCeaseRelevant will be used | |
| uint8 | bNotifyTick: 1 |
| if set, OnTick will be used | |
| uint8 | bTickIntervals: 1 |
| if set, conditional tick will use remaining time form node's memory | |
| uint8 | ChildIndex |
| child index in parent node | |
Behavior Tree service nodes is designed to perform "background" tasks that update AI's knowledge.
Services are being executed when underlying branch of behavior tree becomes active, but unlike tasks they don't return any results and can't directly affect execution flow.
Usually they perform periodical checks (see TickNode) and often store results in blackboard. If any decorator node below requires results of check beforehand, use OnSearchStart function. Keep in mind that any checks performed there have to be instantaneous!
Other typical use case is creating a marker when specific branch is being executed (see OnBecomeRelevant, OnCeaseRelevant), by setting a flag in blackboard.
Because some of them can be instanced for specific AI, following virtual functions are not marked as const:
If your node is not being instanced (default behavior), DO NOT change any properties of object within those functions! Template nodes are shared across all behavior tree components using the same tree asset and must store their runtime properties in provided NodeMemory block (allocation size determined by GetInstanceMemorySize() )