Payback 0.0.1
CK Graduation Project
로딩중...
검색중...
일치하는것 없음
ASpawnHub 클래스 참조

#include <SpawnHub.h>

ASpawnHub에 대한 상속 다이어그램 :
Inheritance graph
ASpawnHub에 대한 협력 다이어그램:
Collaboration graph

Public 멤버 함수

void InitializeHub (UStageManagementSubsystem *InStageManager)
 
void RegisterSpawnSystem (UActorComponent *SpawnSystem)
 
void UnregisterSpawnSystem (UActorComponent *SpawnSystem)
 
TArray< ITargetableInterface * > GetAllSpawnedTargetableEntity () const
 
UActorComponent * GetOrCreateSpawnSystem (UPARAM(meta=(MustImplement="/Script/CK_UE.SpawnSystemInterface")) TSubclassOf< UActorComponent > SpawnSystemClass)
 
template<CSpawnSystem TSpawnSystem>
TSpawnSystem * GetSpawnSystem () const
 
template<CSpawnSystem TSpawnSystem>
TSpawnSystem * GetOrCreateSpawnSystem ()
 
template<CSpawnSystem TSpawnSystem>
TArray< TSpawnSystem * > GetRegisteredSpawnSystems () const
 

Private 속성

TWeakObjectPtr< UStageManagementSubsystemStageManager
 
TArray< TWeakObjectPtr< UActorComponent > > RegisteredSpawnSystems
 

상세한 설명

현재 스테이지(레벨)에 존재하는 모든 스폰된 객체들을 관리하는 글로벌 허브. 각 SpawnSystemComponent를 소유하고, 스폰된 객체 조회의 단일 진입점 역할을 한다.

멤버 함수 문서화

◆ GetAllSpawnedTargetableEntity()

TArray< ITargetableInterface * > ASpawnHub::GetAllSpawnedTargetableEntity ( ) const
76{
77 TArray<ITargetableInterface*> Result;
78
79 for (const TWeakObjectPtr<UActorComponent>& Weak : RegisteredSpawnSystems)
80 {
81 if (const ISpawnSystemInterface* SpawnSystem = Cast<ISpawnSystemInterface>(Weak.Get()))
82 {
83 SpawnSystem->CollectSpawnedTargetables(Result);
84 }
85 }
86
87 return Result;
88}
TArray< TWeakObjectPtr< UActorComponent > > RegisteredSpawnSystems
Definition SpawnHub.h:58
Definition SpawnSystemInterface.h:24

◆ GetOrCreateSpawnSystem() [1/2]

template<CSpawnSystem TSpawnSystem>
TSpawnSystem * ASpawnHub::GetOrCreateSpawnSystem ( )
78{
79 TSpawnSystem* SpawnSystem = FindComponentByClass<TSpawnSystem>();
80
81 if (SpawnSystem)
82 {
83 RegisterSpawnSystem(SpawnSystem);
84 return SpawnSystem;
85 }
86
87 SpawnSystem = NewObject<TSpawnSystem>(this, TSpawnSystem::StaticClass());
88 SpawnSystem->RegisterComponent();
89 SpawnSystem->Initialize(StageManager.Get());
90 RegisterSpawnSystem(SpawnSystem);
91 return SpawnSystem;
92}
TWeakObjectPtr< UStageManagementSubsystem > StageManager
Definition SpawnHub.h:55
void RegisterSpawnSystem(UActorComponent *SpawnSystem)
Definition SpawnHub.cpp:24
이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:

◆ GetOrCreateSpawnSystem() [2/2]

UActorComponent * ASpawnHub::GetOrCreateSpawnSystem ( UPARAM(meta=(MustImplement="/Script/CK_UE.SpawnSystemInterface")) TSubclassOf< UActorComponent >  SpawnSystemClass)
이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ GetRegisteredSpawnSystems()

template<CSpawnSystem TSpawnSystem>
TArray< TSpawnSystem * > ASpawnHub::GetRegisteredSpawnSystems ( ) const
97{
98 TArray<TSpawnSystem*> Result;
99
100 for (const TWeakObjectPtr<UActorComponent>& Weak : RegisteredSpawnSystems)
101 {
102 if (TSpawnSystem* SpawnSystem = Cast<TSpawnSystem>(Weak.Get()))
103 {
104 Result.Add(SpawnSystem);
105 }
106 }
107
108 return Result;
109}

◆ GetSpawnSystem()

template<CSpawnSystem TSpawnSystem>
TSpawnSystem * ASpawnHub::GetSpawnSystem ( ) const
64{
65 TSpawnSystem* SpawnSystem = FindComponentByClass<TSpawnSystem>();
66
67 if (SpawnSystem == nullptr)
68 {
69 LOG_ERROR(LogCK, "%s가 존재하지 않습니다. ", NAMEOF(TSpawnSystem));
70 }
71
72 return SpawnSystem;
73}
#define LOG_ERROR(Category, Format,...)
Definition CK_UE.h:40
#define NAMEOF(Type)
Definition CK_UE.h:30

◆ InitializeHub()

void ASpawnHub::InitializeHub ( UStageManagementSubsystem InStageManager)
14{
15 StageManager = InStageManager;
16
18 GetOrCreateSpawnSystem<UEnemySpawnDirectorSystemComponent>();
19 GetOrCreateSpawnSystem<UProjectileSpawnSystemComponent>();
20 GetOrCreateSpawnSystem<UInteractableSpawnSystemComponent>();
21}

◆ RegisterSpawnSystem()

void ASpawnHub::RegisterSpawnSystem ( UActorComponent *  SpawnSystem)
25{
26 if (Cast<ISpawnSystemInterface>(SpawnSystem) == nullptr)
27 {
28 return;
29 }
30
31 RegisteredSpawnSystems.AddUnique(SpawnSystem);
32}
이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ UnregisterSpawnSystem()

void ASpawnHub::UnregisterSpawnSystem ( UActorComponent *  SpawnSystem)
36{
37 auto IsUnregisterTarget = [SpawnSystem](const TWeakObjectPtr<UActorComponent>& Weak)
38 {
39 return Weak.Get() == SpawnSystem || Weak.IsValid() == false;
40 };
41
42 RegisteredSpawnSystems.RemoveAll(IsUnregisterTarget);
43}

멤버 데이터 문서화

◆ RegisteredSpawnSystems

TArray<TWeakObjectPtr<UActorComponent> > ASpawnHub::RegisteredSpawnSystems
private

◆ StageManager

TWeakObjectPtr<UStageManagementSubsystem> ASpawnHub::StageManager
private

이 클래스에 대한 문서화 페이지는 다음의 파일들로부터 생성되었습니다.: