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]
60 lines
1.4 KiB
C++
60 lines
1.4 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "BehaviorTree/TestBTTask_Log.h"
|
|
#include "MockAI_BT.h"
|
|
|
|
UTestBTTask_Log::UTestBTTask_Log(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer)
|
|
{
|
|
NodeName = "Log";
|
|
ExecutionTicks = 0;
|
|
LogIndex = 0;
|
|
LogFinished = -1;
|
|
LogResult = EBTNodeResult::Succeeded;
|
|
LogTickIndex = -1;
|
|
|
|
INIT_TASK_NODE_NOTIFY_FLAGS();
|
|
}
|
|
|
|
EBTNodeResult::Type UTestBTTask_Log::ExecuteTask(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory)
|
|
{
|
|
FBTLogTaskMemory* MyMemory = CastInstanceNodeMemory<FBTLogTaskMemory>(NodeMemory);
|
|
MyMemory->EndFrameIdx = ExecutionTicks + FAITestHelpers::FramesCounter();
|
|
|
|
LogExecution(OwnerComp, LogIndex);
|
|
if (ExecutionTicks == 0)
|
|
{
|
|
return LogResult;
|
|
}
|
|
|
|
return EBTNodeResult::InProgress;
|
|
}
|
|
|
|
void UTestBTTask_Log::TickTask(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory, float DeltaSeconds)
|
|
{
|
|
FBTLogTaskMemory* MyMemory = CastInstanceNodeMemory<FBTLogTaskMemory>(NodeMemory);
|
|
|
|
if (LogTickIndex != -1)
|
|
{
|
|
LogExecution(OwnerComp, LogTickIndex);
|
|
}
|
|
|
|
if (FAITestHelpers::FramesCounter() >= MyMemory->EndFrameIdx)
|
|
{
|
|
LogExecution(OwnerComp, LogFinished);
|
|
FinishLatentTask(OwnerComp, LogResult);
|
|
}
|
|
}
|
|
|
|
uint16 UTestBTTask_Log::GetInstanceMemorySize() const
|
|
{
|
|
return sizeof(FBTLogTaskMemory);
|
|
}
|
|
|
|
void UTestBTTask_Log::LogExecution(UBehaviorTreeComponent& OwnerComp, int32 LogNumber)
|
|
{
|
|
if (LogNumber >= 0)
|
|
{
|
|
UMockAI_BT::ExecutionLog.Add(LogNumber);
|
|
}
|
|
}
|