EBTNodeResult::Type UBTTaskNode::WrappedAbortTask(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory) const { UBTNode* NodeOb = const_cast<UBTNode*>(bCreateNodeInstance ? GetNodeInstance(OwnerComp, NodeMemory) : this); UBTTaskNode* TaskNodeOb = static_cast<UBTTaskNode*>(NodeOb); EBTNodeResult::Type Result = TaskNodeOb ? TaskNodeOb->AbortTask(OwnerComp, NodeMemory) : EBTNodeResult::Aborted; return Result; }
UBTNode* UBTNode::GetNodeInstance(const UBehaviorTreeComponent* OwnerComp, uint8* NodeMemory) const { if (OwnerComp) { return GetNodeInstance(*OwnerComp, NodeMemory); } return nullptr; }
void UBTNode::CleanupInSubtree(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory, EBTMemoryClear::Type CleanupType) const { const UBTNode* NodeOb = bCreateNodeInstance ? GetNodeInstance(OwnerComp, NodeMemory) : this; if (NodeOb) { NodeOb->CleanupMemory(OwnerComp, NodeMemory, CleanupType); } }
void UBTTaskNode::WrappedTickTask(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory, float DeltaSeconds) const { if (bNotifyTick) { const UBTNode* NodeOb = bCreateNodeInstance ? GetNodeInstance(OwnerComp, NodeMemory) : this; if (NodeOb) { ((UBTTaskNode*)NodeOb)->TickTask(OwnerComp, NodeMemory, DeltaSeconds); } } }
void UBTDecorator::WrappedOnNodeProcessed(FBehaviorTreeSearchData& SearchData, EBTNodeResult::Type& NodeResult) const { if (bNotifyProcessed) { const UBTNode* NodeOb = bCreateNodeInstance ? GetNodeInstance(SearchData) : this; if (NodeOb) { ((UBTDecorator*)NodeOb)->OnNodeProcessed(SearchData, NodeResult); } } }
void UBTDecorator::WrappedOnNodeDeactivation(FBehaviorTreeSearchData& SearchData, EBTNodeResult::Type NodeResult) const { if (bNotifyDeactivation) { const UBTNode* NodeOb = bCreateNodeInstance ? GetNodeInstance(SearchData) : this; if (NodeOb) { ((UBTDecorator*)NodeOb)->OnNodeDeactivation(SearchData, NodeResult); } } }
void UBTDecorator::WrappedOnNodeActivation(FBehaviorTreeSearchData& SearchData) const { if (bNotifyActivation) { const UBTNode* NodeOb = bCreateNodeInstance ? GetNodeInstance(SearchData) : this; if (NodeOb) { ((UBTDecorator*)NodeOb)->OnNodeActivation(SearchData); } } };
void UBTService::NotifyParentActivation(struct FBehaviorTreeSearchData& SearchData) { if (bNotifyOnSearch) { UBTNode* NodeOb = bCreateNodeInstance ? GetNodeInstance(SearchData) : this; if (NodeOb) { ((UBTService*)NodeOb)->OnSearchStart(SearchData); } } }
FString UBTNode::GetRuntimeDescription(const UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory, EBTDescriptionVerbosity::Type Verbosity) const { FString Description = NodeName.Len() ? FString::Printf(TEXT("%d. %s [%s]"), ExecutionIndex, *NodeName, *GetStaticDescription()) : GetStaticDescription(); TArray<FString> RuntimeValues; const UBTNode* NodeOb = bCreateNodeInstance ? GetNodeInstance(OwnerComp, NodeMemory) : this; if (NodeOb) { NodeOb->DescribeRuntimeValues(OwnerComp, NodeMemory, Verbosity, RuntimeValues); } for (int32 ValueIndex = 0; ValueIndex < RuntimeValues.Num(); ValueIndex++) { Description += TEXT(", "); Description += RuntimeValues[ValueIndex]; } return Description; }
void UBTTaskNode::WrappedOnTaskFinished(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory, EBTNodeResult::Type TaskResult) const { UBTNode* NodeOb = const_cast<UBTNode*>(bCreateNodeInstance ? GetNodeInstance(OwnerComp, NodeMemory) : this); if (NodeOb) { UBTTaskNode* TaskNodeOb = static_cast<UBTTaskNode*>(NodeOb); if (TaskNodeOb->bNotifyTaskFinished) { TaskNodeOb->OnTaskFinished(OwnerComp, NodeMemory, TaskResult); } if (TaskNodeOb->bOwnsGameplayTasks && OwnerComp.GetAIOwner()) { UGameplayTasksComponent* GTComp = OwnerComp.GetAIOwner()->GetGameplayTasksComponent(); if (GTComp) { GTComp->EndAllResourceConsumingTasksOwnedBy(*TaskNodeOb); } } } }
EBTNodeResult::Type UBTTaskNode::WrappedExecuteTask(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory) const { const UBTNode* NodeOb = bCreateNodeInstance ? GetNodeInstance(OwnerComp, NodeMemory) : this; return NodeOb ? ((UBTTaskNode*)NodeOb)->ExecuteTask(OwnerComp, NodeMemory) : EBTNodeResult::Failed; }
UBTNode* UBTNode::GetNodeInstance(FBehaviorTreeSearchData& SearchData) const { return GetNodeInstance(SearchData.OwnerComp, GetNodeMemory<uint8>(SearchData)); }
bool UBTDecorator::WrappedCanExecute(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory) const { const UBTDecorator* NodeOb = bCreateNodeInstance ? (const UBTDecorator*)GetNodeInstance(OwnerComp, NodeMemory) : this; return NodeOb ? (IsInversed() != NodeOb->CalculateRawConditionValue(OwnerComp, NodeMemory)) : false; }
float UBTDecorator_UtilityFunction::WrappedCalculateUtility(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory) const { const UBTDecorator_UtilityFunction* NodeOb = bCreateNodeInstance ? (const UBTDecorator_UtilityFunction*)GetNodeInstance(OwnerComp, NodeMemory) : this; return NodeOb ? NodeOb->CalculateUtilityValue(OwnerComp, NodeMemory) : 0.0f; }