level pack loading added, pawn walking camera fixed
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "ResComLevelPackLoader.h"
|
||||
|
||||
// Sets default values
|
||||
AResComLevelPackLoader::AResComLevelPackLoader()
|
||||
{
|
||||
// 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;
|
||||
PrimaryActorTick.TickInterval = 0.5f;
|
||||
|
||||
}
|
||||
|
||||
// Called when the game starts or when spawned
|
||||
void AResComLevelPackLoader::BeginPlay()
|
||||
{
|
||||
Super::BeginPlay();
|
||||
|
||||
}
|
||||
|
||||
// Called every frame
|
||||
void AResComLevelPackLoader::Tick(float DeltaTime)
|
||||
{
|
||||
Super::Tick(DeltaTime);
|
||||
|
||||
if (packLoading->IsLoaded())
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
}
|
||||
|
||||
void AResComLevelPackLoader::LoadPack(FFloorPack* pack)
|
||||
{
|
||||
FLatentActionInfo latentInfo;
|
||||
latentInfo.CallbackTarget = this;
|
||||
latentInfo.UUID = 0;
|
||||
latentInfo.Linkage = 0;
|
||||
|
||||
latentInfo.ExecutionFunction = "OnLevelPreview";
|
||||
for (auto& level : pack.levelsPreview)
|
||||
{
|
||||
++queueElem.visibleCnt;
|
||||
++latentInfo.UUID;
|
||||
UGameplayStatics::LoadStreamLevel(this, *level, true, true, latentInfo);
|
||||
}
|
||||
|
||||
latentInfo.ExecutionFunction = "OnLevelVisible";
|
||||
for (auto& level : pack.levelsShouldBeVisible)
|
||||
{
|
||||
++queueElem.previewCnt;
|
||||
++latentInfo.UUID;
|
||||
UGameplayStatics::LoadStreamLevel(this, *level, true, true, latentInfo);
|
||||
}
|
||||
|
||||
latentInfo.ExecutionFunction = "OnLevelLoaded";
|
||||
for (auto& level : pack.levelsShouldBeLoaded)
|
||||
{
|
||||
queueElem.loadedCnt;
|
||||
++latentInfo.UUID;
|
||||
UGameplayStatics::LoadStreamLevel(this, *level, true, true, latentInfo);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
Reference in New Issue
Block a user