Move NextLevel referene to LevelEndTriggerVolume

This commit is contained in:
baz 2024-03-12 20:12:20 +00:00
parent 18ab3a5434
commit 95aa4285e3
4 changed files with 8 additions and 5 deletions

View File

@ -35,7 +35,7 @@ void ALevelEndTriggerVolume::OnOverlapBegin(UPrimitiveComponent* OverlappedCompo
{ {
GetCollisionComponent()->OnComponentBeginOverlap.Clear(); GetCollisionComponent()->OnComponentBeginOverlap.Clear();
gameInstance->GetCurrentLevelManager()->LoadNextLevel(); gameInstance->GetCurrentLevelManager()->LoadNextLevel(NextLevel);
this->Destroy(); this->Destroy();
} }

View File

@ -14,6 +14,11 @@ class NAKATOMI_API ALevelEndTriggerVolume : public ATriggerBox
{ {
GENERATED_BODY() GENERATED_BODY()
private:
UPROPERTY(EditDefaultsOnly, Meta = (AllowPrivateAccess = "true"))
TSoftObjectPtr<UWorld> NextLevel;
protected: protected:
virtual void BeginPlay() override; virtual void BeginPlay() override;

View File

@ -19,7 +19,7 @@ void UNakatomiLevelManager::BeginPlay(UWorld* world)
} }
} }
void UNakatomiLevelManager::LoadNextLevel() void UNakatomiLevelManager::LoadNextLevel(TSoftObjectPtr<UWorld> NextLevel)
{ {
if (!NextLevel.IsNull()) if (!NextLevel.IsNull())
{ {

View File

@ -16,8 +16,6 @@ class NAKATOMI_API UNakatomiLevelManager : public UObject
UNakatomiLevelManager(); UNakatomiLevelManager();
private: private:
UPROPERTY(EditDefaultsOnly, Meta = (AllowPrivateAccess = "true"))
TSoftObjectPtr<UWorld> NextLevel;
int InitialLevelKeys = 0; int InitialLevelKeys = 0;
@ -25,7 +23,7 @@ private:
public: public:
UFUNCTION() UFUNCTION()
void LoadNextLevel(); void LoadNextLevel(TSoftObjectPtr<UWorld> NextLevel);
UFUNCTION() UFUNCTION()
void IncrementInitialLevelKeys(); void IncrementInitialLevelKeys();