2021-12-01 10:50:36 -05:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
2021-11-24 04:26:29 -05:00
|
|
|
|
|
|
|
|
#include "Blueprint/StateTreeConditionBlueprintBase.h"
|
|
|
|
|
#include "CoreMinimal.h"
|
|
|
|
|
#include "StateTreeExecutionContext.h"
|
2021-12-01 10:50:36 -05:00
|
|
|
#include "Engine/Blueprint.h"
|
2021-11-24 04:26:29 -05:00
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------//
|
|
|
|
|
// UStateTreeConditionBlueprintBase
|
|
|
|
|
//----------------------------------------------------------------------//
|
|
|
|
|
|
2022-05-11 04:04:58 -04:00
|
|
|
bool UStateTreeConditionBlueprintBase::TestCondition(FStateTreeExecutionContext& Context) const
|
2021-11-24 04:26:29 -05:00
|
|
|
{
|
|
|
|
|
AActor* OwnerActor = GetOwnerActor(Context);
|
|
|
|
|
return ReceiveTestCondition(OwnerActor);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------//
|
|
|
|
|
// FStateTreeBlueprintConditionWrapper
|
|
|
|
|
//----------------------------------------------------------------------//
|
|
|
|
|
|
|
|
|
|
bool FStateTreeBlueprintConditionWrapper::Link(FStateTreeLinker& Linker)
|
|
|
|
|
{
|
|
|
|
|
const UStateTreeConditionBlueprintBase* CondCDO = ConditionClass ? ConditionClass->GetDefaultObject<UStateTreeConditionBlueprintBase>() : nullptr;
|
|
|
|
|
if (CondCDO != nullptr)
|
|
|
|
|
{
|
|
|
|
|
CondCDO->LinkExternalData(Linker, ExternalDataHandles);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool FStateTreeBlueprintConditionWrapper::TestCondition(FStateTreeExecutionContext& Context) const
|
|
|
|
|
{
|
|
|
|
|
if (UStateTreeConditionBlueprintBase* Instance = Context.GetInstanceObjectInternal<UStateTreeConditionBlueprintBase>(DataViewIndex))
|
|
|
|
|
{
|
|
|
|
|
Instance->CopyExternalData(Context, ExternalDataHandles);
|
|
|
|
|
return Instance->TestCondition(Context);
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2021-12-01 03:42:52 -05:00
|
|
|
|