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"
|
|
|
|
#include "Math/BoxSphereBounds.h"
|
|
|
|
#include "Math/MathFwd.h"
|
|
|
|
#include "Misc/AssertionMacros.h"
|
|
|
|
#include "UObject/Object.h"
|
|
|
|
#include "UObject/UObjectGlobals.h"
|
|
|
|
|
2022-05-23 18:41:30 +00:00
|
|
|
#include "PocketLevelInstance.generated.h"
|
|
|
|
|
|
|
|
class ULevelStreamingDynamic;
|
2022-09-13 07:18:28 +00:00
|
|
|
class ULocalPlayer;
|
|
|
|
class UPocketLevel;
|
2022-05-23 18:41:30 +00:00
|
|
|
class UPocketLevelInstance;
|
2022-09-13 07:18:28 +00:00
|
|
|
class UWorld;
|
|
|
|
struct FFrame;
|
2022-05-23 18:41:30 +00:00
|
|
|
|
|
|
|
DECLARE_MULTICAST_DELEGATE_OneParam(FPocketLevelInstanceEvent, UPocketLevelInstance*);
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
UCLASS(Within = PocketLevelSubsystem, BlueprintType)
|
|
|
|
class POCKETWORLDS_API UPocketLevelInstance : public UObject
|
|
|
|
{
|
|
|
|
GENERATED_BODY()
|
|
|
|
|
|
|
|
public:
|
|
|
|
UPocketLevelInstance();
|
|
|
|
|
|
|
|
virtual void BeginDestroy() override;
|
|
|
|
|
|
|
|
void StreamIn();
|
|
|
|
void StreamOut();
|
|
|
|
|
|
|
|
FDelegateHandle AddReadyCallback(FPocketLevelInstanceEvent::FDelegate Callback);
|
|
|
|
void RemoveReadyCallback(FDelegateHandle CallbackToRemove);
|
|
|
|
|
|
|
|
virtual class UWorld* GetWorld() const override { return World; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool Initialize(ULocalPlayer* LocalPlayer, UPocketLevel* PocketLevel, FVector SpawnPoint);
|
|
|
|
|
|
|
|
UFUNCTION()
|
|
|
|
void HandlePocketLevelLoaded();
|
|
|
|
|
|
|
|
UFUNCTION()
|
|
|
|
void HandlePocketLevelShown();
|
|
|
|
|
|
|
|
private:
|
|
|
|
UPROPERTY()
|
2022-09-13 07:18:28 +00:00
|
|
|
TObjectPtr<ULocalPlayer> LocalPlayer;
|
2022-05-23 18:41:30 +00:00
|
|
|
|
|
|
|
UPROPERTY()
|
2022-09-13 07:18:28 +00:00
|
|
|
TObjectPtr<UPocketLevel> PocketLevel;
|
2022-05-23 18:41:30 +00:00
|
|
|
|
|
|
|
UPROPERTY()
|
2022-09-13 07:18:28 +00:00
|
|
|
TObjectPtr<UWorld> World;
|
2022-05-23 18:41:30 +00:00
|
|
|
|
|
|
|
UPROPERTY()
|
2022-09-13 07:18:28 +00:00
|
|
|
TObjectPtr<ULevelStreamingDynamic> StreamingPocketLevel;
|
2022-05-23 18:41:30 +00:00
|
|
|
|
|
|
|
FPocketLevelInstanceEvent OnReadyEvent;
|
|
|
|
|
|
|
|
FBoxSphereBounds Bounds;
|
|
|
|
|
|
|
|
friend class UPocketLevelSubsystem;
|
|
|
|
};
|