Projekt for SPIE - Avatar for safety briefing / managment event
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

59 lines
1.3 KiB

// Copyright Low Entry. Apache License, Version 2.0.
#pragma once
#include "CoreMinimal.h"
#include "LatentActions.h"
class FLowEntryTickFrames : public FPendingLatentAction
{
public:
FName ExecutionFunction;
int32 OutputLink;
FWeakObjectPtr CallbackTarget;
const int32 Ticks;
const int32 FramesInterval;
int32& Tick;
int32 CurrentFramesInterval = 0;
FLowEntryTickFrames(const FLatentActionInfo& LatentInfo, const int32 Ticks0, const int32 FramesInterval0, int32& Tick0)
: ExecutionFunction(LatentInfo.ExecutionFunction)
, OutputLink(LatentInfo.Linkage)
, CallbackTarget(LatentInfo.CallbackTarget)
, Ticks(Ticks0)
, FramesInterval(FramesInterval0)
, Tick(Tick0)
{
Tick0 = 0;
}
virtual void UpdateOperation(FLatentResponse& Response) override
{
if (Tick >= Ticks)
{
Response.DoneIf(true);
return;
}
CurrentFramesInterval++;
if (CurrentFramesInterval >= FramesInterval)
{
CurrentFramesInterval = 0;
Tick++;
Response.TriggerLink(ExecutionFunction, OutputLink, CallbackTarget);
}
}
#if WITH_EDITOR
// Returns a human readable description of the latent operation's current state
virtual FString GetDescription() const override
{
return FString::Printf(TEXT("Ticking (%i ticks left)"), (Ticks - Tick));
}
#endif
};