You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
* Removed includes (using IWYU) in private files #preflight 63c79978ac35a0e9dabbe408 #rb none [CL 23770038 by henrik karlsson in ue5-main branch]
38 lines
1.0 KiB
C++
38 lines
1.0 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "StateTreeDelayTask.h"
|
|
#include "StateTreeExecutionContext.h"
|
|
|
|
#include UE_INLINE_GENERATED_CPP_BY_NAME(StateTreeDelayTask)
|
|
|
|
EStateTreeRunStatus FStateTreeDelayTask::EnterState(FStateTreeExecutionContext& Context, const FStateTreeTransitionResult& Transition) const
|
|
{
|
|
FInstanceDataType& InstanceData = Context.GetInstanceData(*this);
|
|
|
|
if (!InstanceData.bRunForever)
|
|
{
|
|
InstanceData.RemainingTime = FMath::FRandRange(
|
|
FMath::Max(0.0f, InstanceData.Duration - InstanceData.RandomDeviation), (InstanceData.Duration + InstanceData.RandomDeviation));
|
|
}
|
|
|
|
return EStateTreeRunStatus::Running;
|
|
}
|
|
|
|
EStateTreeRunStatus FStateTreeDelayTask::Tick(FStateTreeExecutionContext& Context, const float DeltaTime) const
|
|
{
|
|
FInstanceDataType& InstanceData = Context.GetInstanceData(*this);
|
|
|
|
if (!InstanceData.bRunForever)
|
|
{
|
|
InstanceData.RemainingTime -= DeltaTime;
|
|
|
|
if (InstanceData.RemainingTime <= 0.f)
|
|
{
|
|
return EStateTreeRunStatus::Succeeded;
|
|
}
|
|
}
|
|
|
|
return EStateTreeRunStatus::Running;
|
|
}
|
|
|