40 lines
891 B
C++
40 lines
891 B
C++
// Fill out your copyright notice in the Description page of Project Settings.
|
|
|
|
|
|
#include "LevelManager.h"
|
|
|
|
// Sets default values
|
|
ALevelManager::ALevelManager()
|
|
{
|
|
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
|
|
PrimaryActorTick.bCanEverTick = true;
|
|
|
|
}
|
|
|
|
// Called when the game starts or when spawned
|
|
void ALevelManager::BeginPlay()
|
|
{
|
|
Super::BeginPlay();
|
|
|
|
}
|
|
|
|
// Called every frame
|
|
void ALevelManager::Tick(float DeltaTime)
|
|
{
|
|
Super::Tick(DeltaTime);
|
|
|
|
}
|
|
|
|
bool ALevelManager::LoadLevel(FString LevelName, bool bVisible, bool bLoad)
|
|
{
|
|
ULevelStreaming* Level = UGameplayStatics::GetStreamingLevel(GetWorld(), *LevelName);
|
|
if (!Level)
|
|
return false;
|
|
Level->SetShouldBeLoaded(bLoad);
|
|
Level->SetShouldBeVisible(bVisible);
|
|
|
|
while (Level->IsLevelVisible() ^ bVisible && Level->IsLevelLoaded() ^ bLoad)
|
|
{
|
|
}
|
|
return true;
|
|
} |