Payback 0.0.1
CK Graduation Project
로딩중...
검색중...
일치하는것 없음
LevelStreamingContext.h
이 파일의 문서화 페이지로 가기
1#pragma once
2
3#include "CoreMinimal.h"
4#include "CK_UE.h"
7#include "LevelStreamingContext.generated.h"
8
9class APlayerController;
10class ULevelStreaming;
11class UWorld;
12
13
14USTRUCT(BlueprintType)
16{
17 GENERATED_BODY()
18
19public:
20 FLevelStreamingContext() : ExecutingEffectIndex(0), Phase() { }
21
22public:
23 static FLevelStreamingContext CreateContext(TWeakObjectPtr<ULevelStreaming> InOriginalWorld, TWeakObjectPtr<ULevelStreaming> InTargetWorld, const FEffectChainExecutor& Executor);
24
25public:
26 UPROPERTY(Transient, BlueprintReadOnly, Category = "LevelStreamContext")
27 TObjectPtr<UWorld> OriginalWorld;
28
29 UPROPERTY(Transient, BlueprintReadOnly, Category = "LevelStreamContext")
30 TObjectPtr<UWorld> TargetWorld;
31
32 UPROPERTY(Transient)
33 TObjectPtr<ULevelStreaming> OriginalStreamingLevel;
34
35 UPROPERTY(Transient)
36 TObjectPtr<ULevelStreaming> TargetStreamingLevel;
37
38 UPROPERTY(Transient, BlueprintReadOnly, Category = "LevelStreamContext")
39 TObjectPtr<APlayerController> PlayerController;
40
41 UPROPERTY(Transient, BlueprintReadOnly, Category = "LevelStreamContext")
42 int32 ExecutingEffectIndex;
43
44 UPROPERTY(Transient, BlueprintReadOnly, Category = "LevelStreamContext")
46};
47
48
49
50inline FLevelStreamingContext FLevelStreamingContext::CreateContext(TWeakObjectPtr<ULevelStreaming> InOriginalWorld, TWeakObjectPtr<ULevelStreaming> InTargetWorld, const FEffectChainExecutor& Executor)
51{
52 if (InOriginalWorld.IsValid() == false)
53 {
54 LOG_ERROR(LogCKLevel, "LevelToUnload가 유효하지 않아, '%s' 를 만들 수 없습니다.", NAMEOF(FLevelStreamingContext));
55 }
56
57 ensureMsgf(Executor.GetChainIndex() >= 0, TEXT("FLevelStreamContext: InExecutingEffectIndex is out of range"));
58
60
61 Context.Phase = Executor.GetPhase();
62 // PreLoad에서는 대상 레벨이 아직 없으므로 현재 레벨에서 플레이어를 찾는다.
63 Context.OriginalStreamingLevel = InOriginalWorld.Get();
64 Context.TargetStreamingLevel = InTargetWorld.Get();
65 Context.ExecutingEffectIndex = Executor.GetChainIndex();
66
67 if (Context.OriginalStreamingLevel)
68 {
69 Context.OriginalWorld = Context.OriginalStreamingLevel->GetWorld();
70 }
71
72 if (Context.OriginalWorld)
73 {
74 Context.PlayerController = Context.OriginalWorld->GetFirstPlayerController();
75 }
76
77 if (Context.TargetStreamingLevel)
78 {
79 Context.TargetWorld = Context.TargetStreamingLevel->GetWorld();
80 }
81
82 return Context;
83}
#define LOG_ERROR(Category, Format,...)
Definition CK_UE.h:41
#define NAMEOF(Type)
Definition CK_UE.h:31
ELevelStreamingPhase
Definition ELevelStreamingEnums.h:7
레벨 스트리밍 이펙트 체인의 순차 실행을 담당합니다.
Definition LevelStreamingEffect.h:23
Definition LevelStreamingContext.h:16
FLevelStreamingContext()
Definition LevelStreamingContext.h:20
TObjectPtr< ULevelStreaming > OriginalStreamingLevel
Definition LevelStreamingContext.h:33
TObjectPtr< APlayerController > PlayerController
Definition LevelStreamingContext.h:39
TObjectPtr< ULevelStreaming > TargetStreamingLevel
Definition LevelStreamingContext.h:36
TObjectPtr< UWorld > OriginalWorld
Definition LevelStreamingContext.h:27
TObjectPtr< UWorld > TargetWorld
Definition LevelStreamingContext.h:30
ELevelStreamingPhase Phase
Definition LevelStreamingContext.h:45
int32 ExecutingEffectIndex
Definition LevelStreamingContext.h:42