File size: 1,389 Bytes
7fd553e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | // Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "Kismet/BlueprintAsyncActionBase.h"
#include "AsyncAction_ExperienceReady.generated.h"
class AGameStateBase;
class ULyraExperienceDefinition;
class UWorld;
struct FFrame;
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;
};
|