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.
 
 
 

66 lines
1.4 KiB

// Copyright Low Entry. Apache License, Version 2.0.
#include "LowEntryLatentActionNone.h"
#include "FLowEntryLatentActionNone.h"
#include "Engine/Engine.h"
ULowEntryLatentActionNone::ULowEntryLatentActionNone(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer)
{
KeepAliveCount = 1;
AddToRoot();
}
ULowEntryLatentActionNone* ULowEntryLatentActionNone::Create()
{
return NewObject<ULowEntryLatentActionNone>();
}
void ULowEntryLatentActionNone::WaitTillDone(UObject* WorldContextObject, FLatentActionInfo LatentInfo)
{
UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
if (World == nullptr)
{
return;
}
if (World->GetLatentActionManager().FindExistingAction<FLowEntryLatentActionNone>(LatentInfo.CallbackTarget, LatentInfo.UUID) != nullptr)
{
return;
}
World->GetLatentActionManager().AddNewAction(LatentInfo.CallbackTarget, LatentInfo.UUID, new FLowEntryLatentActionNone(LatentInfo, this));
KeepAliveCount++;
if (KeepAliveCount == 1)
{
AddToRoot();
}
}
void ULowEntryLatentActionNone::LatentActionDone()
{
KeepAliveCount--;
if (KeepAliveCount == 0)
{
RemoveFromRoot();
}
if (KeepAliveCount < 0)
{
KeepAliveCount = 0;
}
}
void ULowEntryLatentActionNone::Done()
{
if (!Finished)
{
LatentActionDone(); // used to reduce KeepAliveCount by 1
Finished = true;
}
}
bool ULowEntryLatentActionNone::IsDone()
{
return Finished;
}