You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
Add a InitNotifyFlags function to UBTAuxiliaryNode, UBTTaskNode, UBTCompositeNode, UBTDecorator and UBTService to setup the various flags that must be set when some functions are overriden. Add macros to call those functions, this is necessary as those functions are protected. Use those macros in various nodes (not all of them, this is not possible for some blueprint tasks) #tests PIE Maxime.Mercier, Karl.Dubois, Guillaume.Arruda [FYI] nicolas.bonnelly, Guillaume.Guay, Loic.Devaux, Mieszko.Zielinski, Guillaume.Morreel #rnx #ROBOMERGE-AUTHOR: charles.lefebvre #ROBOMERGE-SOURCE: CL 18385614 via CL 18385628 via CL 18385644 via CL 18434568 via CL 18435684 #ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v897-18405271) [CL 18436637 by charles lefebvre in ue5-release-engine-test branch]
75 lines
1.8 KiB
C++
75 lines
1.8 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "BehaviorTree/TestBTService_Log.h"
|
|
#include "BehaviorTree/BlackboardComponent.h"
|
|
#include "MockAI_BT.h"
|
|
|
|
UTestBTService_Log::UTestBTService_Log(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer)
|
|
{
|
|
NodeName = "LogService";
|
|
|
|
INIT_SERVICE_NODE_NOTIFY_FLAGS();
|
|
|
|
LogActivation = INDEX_NONE;
|
|
LogDeactivation = INDEX_NONE;
|
|
KeyNameTick = NAME_None;
|
|
LogTick = INDEX_NONE;
|
|
KeyNameBecomeRelevant = NAME_None;
|
|
KeyNameCeaseRelevant = NAME_None;
|
|
|
|
// Force the service to tick every frame
|
|
Interval = 0.0f;
|
|
RandomDeviation = 0.0f;
|
|
}
|
|
|
|
void UTestBTService_Log::OnBecomeRelevant(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory)
|
|
{
|
|
Super::OnBecomeRelevant(OwnerComp, NodeMemory);
|
|
|
|
if (KeyNameBecomeRelevant != NAME_None)
|
|
{
|
|
OwnerComp.GetBlackboardComponent()->SetValueAsBool(KeyNameBecomeRelevant, true);
|
|
}
|
|
|
|
if (LogActivation >= 0)
|
|
{
|
|
UMockAI_BT::ExecutionLog.Add(LogActivation);
|
|
}
|
|
}
|
|
|
|
void UTestBTService_Log::OnCeaseRelevant(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory)
|
|
{
|
|
Super::OnCeaseRelevant(OwnerComp, NodeMemory);
|
|
|
|
if (KeyNameCeaseRelevant != NAME_None)
|
|
{
|
|
OwnerComp.GetBlackboardComponent()->SetValueAsBool(KeyNameCeaseRelevant, true);
|
|
}
|
|
|
|
if (LogDeactivation >= 0)
|
|
{
|
|
UMockAI_BT::ExecutionLog.Add(LogDeactivation);
|
|
}
|
|
}
|
|
|
|
void UTestBTService_Log::TickNode(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory, float DeltaSeconds)
|
|
{
|
|
Super::TickNode(OwnerComp, NodeMemory, DeltaSeconds);
|
|
|
|
if (KeyNameTick != NAME_None)
|
|
{
|
|
OwnerComp.GetBlackboardComponent()->SetValueAsBool(KeyNameTick, true);
|
|
}
|
|
|
|
if (LogTick >= 0)
|
|
{
|
|
UMockAI_BT::ExecutionLog.Add(LogTick);
|
|
}
|
|
}
|
|
|
|
void UTestBTService_Log::SetFlagOnTick(FName InKeyNameTick, bool bInCallTickOnSearchStart /* = false */)
|
|
{
|
|
KeyNameTick = InKeyNameTick;
|
|
bCallTickOnSearchStart = bInCallTickOnSearchStart;
|
|
}
|