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

#include <ProjectileSpawnSystemComponent.h>

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

Public 멤버 함수

 UProjectileSpawnSystemComponent ()
 
virtual void Initialize (UStageManagementSubsystem *InStageManagementSubsystem) override
 
virtual void ClearAll (const bool bClearSpawnedActorsToo=true) override
 
virtual bool IsComponentTickEnabled () const override
 
AProjectileBaseSpawnProjectile (UObject *Outer, const TSubclassOf< AProjectileBase > ProjectileClass, const FVector &Location, const FRotator &Rotation)
 
void DespawnProjectile (UObject *Outer, AProjectileBase *Projectile)
 
int32 GetAllSpawnedProjectileCount () const
 
TArray< AProjectileBase * > GetAllSpawnedProjectiles () const
 
- ISpawnSystemInterface(으)로부터 상속된 Public 멤버 함수
virtual void CollectSpawnedTargetables (TArray< ITargetableInterface * > &OutTargetables) const
 

Private 속성

TMap< TObjectPtr< UObject >, FProjectileContainerProjectileContainerMap
 
TWeakObjectPtr< UStageManagementSubsystemStageManagementSystem
 

생성자 & 소멸자 문서화

◆ UProjectileSpawnSystemComponent()

UProjectileSpawnSystemComponent::UProjectileSpawnSystemComponent ( )
13{
14 PrimaryComponentTick.bCanEverTick = false;
15}

멤버 함수 문서화

◆ ClearAll()

void UProjectileSpawnSystemComponent::ClearAll ( const bool  bClearSpawnedActorsToo = true)
overridevirtual

ISpawnSystemInterface를 구현.

25{
26 if (ProjectileContainerMap.IsEmpty())
27 {
28 return;
29 }
30
31 // ForceEarlyFinish는 비활성화 델리게이트를 통해 DespawnProjectile을 재진입시킬 수 있으므로,
32 // 맵을 먼저 비운 뒤 복사본을 순회한다.
33 TArray<AProjectileBase*> Projectiles = GetAllSpawnedProjectiles();
35
36 if (bClearSpawnedActorsToo == false)
37 {
38 return;
39 }
40
41 const AActor* Owner = GetOwner();
42
43 for (AProjectileBase* Projectile : Projectiles)
44 {
45 if (Projectile == nullptr || IsValid(Projectile) == false)
46 {
47 continue;
48 }
49
50 if (Projectile->GetProjectileState() == EProjectileState::Finished)
51 {
52 continue;
53 }
54
55 Projectile->ForceEarlyFinish(Owner, EProjectileFinishReason::ExternalTermination);
56 }
57}
Definition ProjectileBase.h:81
TMap< TObjectPtr< UObject >, FProjectileContainer > ProjectileContainerMap
Definition ProjectileSpawnSystemComponent.h:52
TArray< AProjectileBase * > GetAllSpawnedProjectiles() const
Definition ProjectileSpawnSystemComponent.cpp:136
이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:

◆ DespawnProjectile()

void UProjectileSpawnSystemComponent::DespawnProjectile ( UObject *  Outer,
AProjectileBase Projectile 
)
90{
91 if (IsValid(Projectile) == false)
92 {
93 LOG_ERROR(LogCK, "인자로 넘어온 %s가 유효하지 않습니다.", NAMEOF(AProjectileBase));
94 return;
95 }
96
97 FProjectileContainer* Container = ProjectileContainerMap.Find(Outer);
98
99 // 이미 해제된 투사체(강제 종료로 인한 재진입 등)는 무시한다.
100 if (Container == nullptr || Container->Projectiles.Remove(Projectile) == 0)
101 {
102 return;
103 }
104
105 if (Container->Projectiles.IsEmpty())
106 {
107 ProjectileContainerMap.Remove(Outer);
108 }
109
110 // 종료 절차의 마지막에서 투사체가 스스로 풀에 반환되므로, 여기서는 반환하지 않는다.
112 {
114 }
115}
#define LOG_ERROR(Category, Format,...)
Definition CK_UE.h:40
#define NAMEOF(Type)
Definition CK_UE.h:30
FORCEINLINE EProjectileState GetProjectileState() const
Definition ProjectileBase.h:100
virtual void ForceEarlyFinish(const AActor *Terminator, const EProjectileFinishReason FinishReason)
Definition ProjectileBase.cpp:181
Definition ProjectileSpawnSystemComponent.h:16
TArray< TObjectPtr< AProjectileBase > > Projectiles
Definition ProjectileSpawnSystemComponent.h:21
이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:

◆ GetAllSpawnedProjectileCount()

int32 UProjectileSpawnSystemComponent::GetAllSpawnedProjectileCount ( ) const
119{
120 if (ProjectileContainerMap.IsEmpty())
121 {
122 return 0;
123 }
124
125 int32 Result = 0;
126
127 for (const auto& [Outer, Container] : ProjectileContainerMap)
128 {
129 Result += Container.Projectiles.Num();
130 }
131
132 return Result;
133}
이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ GetAllSpawnedProjectiles()

TArray< AProjectileBase * > UProjectileSpawnSystemComponent::GetAllSpawnedProjectiles ( ) const
137{
138 if (ProjectileContainerMap.IsEmpty())
139 {
140 return TArray<AProjectileBase*>();
141 }
142
143 TArray<AProjectileBase*> Result;
144 Result.Reserve(GetAllSpawnedProjectileCount());
145
146 for (const auto& [Outer, Container] : ProjectileContainerMap)
147 {
148 Result.Append(Container.Projectiles);
149 }
150
151 return Result;
152}
int32 GetAllSpawnedProjectileCount() const
Definition ProjectileSpawnSystemComponent.cpp:118
이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:
이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ Initialize()

void UProjectileSpawnSystemComponent::Initialize ( UStageManagementSubsystem InStageManagementSubsystem)
overridevirtual

ISpawnSystemInterface를 구현.

19{
20 StageManagementSystem = InStageManagementSubsystem;
21}
TWeakObjectPtr< UStageManagementSubsystem > StageManagementSystem
Definition ProjectileSpawnSystemComponent.h:55

◆ IsComponentTickEnabled()

bool UProjectileSpawnSystemComponent::IsComponentTickEnabled ( ) const
overridevirtual
61{
62 return Super::IsComponentTickEnabled();
63}

◆ SpawnProjectile()

AProjectileBase * UProjectileSpawnSystemComponent::SpawnProjectile ( UObject *  Outer,
const TSubclassOf< AProjectileBase ProjectileClass,
const FVector &  Location,
const FRotator &  Rotation 
)
67{
68 if (ProjectileClass == nullptr)
69 {
70 LOG_ERROR(LogCK, "ProjectileClass가 nullptr입니다.");
71 return nullptr;
72 }
73
74 UPoolWorldSubsystem* Pool = GetWorld()->GetSubsystem<UPoolWorldSubsystem>();
75 AActor* Spawned = Pool->GetActorFromPool(ProjectileClass, Location, Rotation);
76 AProjectileBase* Projectile = Cast<AProjectileBase>(Spawned);
77
78 if (Projectile == nullptr)
79 {
80 LOG_ERROR(LogCK, "%s를 풀에서 가져오지 못했습니다.", NAMEOF(AProjectileBase));
81 return nullptr;
82 }
83
84 ProjectileContainerMap.FindOrAdd(Outer).Projectiles.Add(Projectile);
85 return Projectile;
86}
Definition PoolWorldSubsystem.h:28
AActor * GetActorFromPool(TSubclassOf< AActor > ActorClass, FVector Location, FRotator Rotation)
Definition PoolWorldSubsystem.cpp:203
이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:

멤버 데이터 문서화

◆ ProjectileContainerMap

TMap<TObjectPtr<UObject>, FProjectileContainer> UProjectileSpawnSystemComponent::ProjectileContainerMap
private

◆ StageManagementSystem

TWeakObjectPtr<UStageManagementSubsystem> UProjectileSpawnSystemComponent::StageManagementSystem
private

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