RealtimeStyleTransferRuntime/Source/LyraGame/GameModes/AsyncAction_ExperienceReady.h

50 lines
1.5 KiB
C
Raw Normal View History

2022-05-23 18:41:30 +00:00
// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
2022-09-13 07:18:28 +00:00
#include "Delegates/Delegate.h"
2022-05-23 18:41:30 +00:00
#include "Kismet/BlueprintAsyncActionBase.h"
2022-09-13 07:18:28 +00:00
#include "UObject/Object.h"
#include "UObject/UObjectGlobals.h"
#include "UObject/WeakObjectPtrTemplates.h"
2022-05-23 18:41:30 +00:00
#include "AsyncAction_ExperienceReady.generated.h"
class AGameStateBase;
class ULyraExperienceDefinition;
2022-09-13 07:18:28 +00:00
class UWorld;
struct FFrame;
2022-05-23 18:41:30 +00:00
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FExperienceReadyAsyncDelegate);
/**
* Asynchronously waits for the game state to be ready and valid and then calls the OnReady event. Will call OnReady
* immediately if the game state is valid already.
*/
UCLASS()
class UAsyncAction_ExperienceReady : public UBlueprintAsyncActionBase
{
GENERATED_UCLASS_BODY()
public:
// Waits for the experience to be determined and loaded
UFUNCTION(BlueprintCallable, meta=(WorldContext = "WorldContextObject", BlueprintInternalUseOnly="true"))
static UAsyncAction_ExperienceReady* WaitForExperienceReady(UObject* WorldContextObject);
virtual void Activate() override;
public:
// Called when the experience has been determined and is ready/loaded
UPROPERTY(BlueprintAssignable)
FExperienceReadyAsyncDelegate OnReady;
private:
void Step1_HandleGameStateSet(AGameStateBase* GameState);
void Step2_ListenToExperienceLoading(AGameStateBase* GameState);
void Step3_HandleExperienceLoaded(const ULyraExperienceDefinition* CurrentExperience);
void Step4_BroadcastReady();
TWeakObjectPtr<UWorld> WorldPtr;
};