level pack loading added, pawn walking camera fixed

This commit is contained in:
C
2022-05-31 16:17:21 +05:00
parent a1c5a6fd1c
commit 7e150b04a8
18 changed files with 143 additions and 36 deletions
@@ -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;
}