You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
- Added ability for tasks to request transitions - Added buffered transition requests - Added callback method to FStateTreeTaskBase which is called during transition triggering - Allow FStateTreeStateLink to be added to tasks and conditions (resolved automatically during compile) #jira UE-174250 #preflight 63ca7ee8977c62635603afcb [CL 23815873 by mikko mononen in ue5-main branch]
48 lines
1.6 KiB
C++
48 lines
1.6 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "Blueprint/StateTreeConditionBlueprintBase.h"
|
|
#include "Blueprint/StateTreeNodeBlueprintBase.h"
|
|
#include "StateTreeExecutionContext.h"
|
|
#include "BlueprintNodeHelpers.h"
|
|
|
|
#include UE_INLINE_GENERATED_CPP_BY_NAME(StateTreeConditionBlueprintBase)
|
|
|
|
//----------------------------------------------------------------------//
|
|
// UStateTreeConditionBlueprintBase
|
|
//----------------------------------------------------------------------//
|
|
|
|
UStateTreeConditionBlueprintBase::UStateTreeConditionBlueprintBase(const FObjectInitializer& ObjectInitializer)
|
|
: Super(ObjectInitializer)
|
|
{
|
|
bHasTestCondition = BlueprintNodeHelpers::HasBlueprintFunction(TEXT("ReceiveTestCondition"), *this, *StaticClass());
|
|
}
|
|
|
|
bool UStateTreeConditionBlueprintBase::TestCondition(FStateTreeExecutionContext& Context) const
|
|
{
|
|
if (bHasTestCondition)
|
|
{
|
|
// Cache the owner and event queue for the duration the condition is evaluated.
|
|
SetCachedInstanceDataFromContext(Context);
|
|
|
|
const bool bResult = ReceiveTestCondition();
|
|
|
|
ClearCachedInstanceData();
|
|
|
|
return bResult;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
//----------------------------------------------------------------------//
|
|
// FStateTreeBlueprintConditionWrapper
|
|
//----------------------------------------------------------------------//
|
|
|
|
bool FStateTreeBlueprintConditionWrapper::TestCondition(FStateTreeExecutionContext& Context) const
|
|
{
|
|
UStateTreeConditionBlueprintBase* Condition = Context.GetInstanceDataPtr<UStateTreeConditionBlueprintBase>(*this);
|
|
check(Condition);
|
|
return Condition->TestCondition(Context);
|
|
}
|
|
|
|
|