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

#include <GameCheatManager.h>

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

Public 멤버 함수

 UGameCheatManager ()
 
virtual void InitCheatManager () override
 
void Suicide ()
 
void Dmg500 ()
 
void Dmg1000 ()
 
void Power ()
 
void ClearPower ()
 
void Kill ()
 

Private 멤버 함수

bool CanExecuteCheat () const
 
bool ApplyInstantDeath (AActor *Target) const
 
void ApplyPlayerHealthDamage (float DamageAmount)
 
void RemovePowerEffect ()
 
void OnPossessedPawnChanged (APawn *OldPawn, APawn *NewPawn)
 

Private 속성

TSubclassOf< UGameplayEffect > InstantDeathEffectClass
 
TWeakObjectPtr< UAbilitySystemComponent > PowerAbilitySystem
 
FActiveGameplayEffectHandle PowerEffectHandle
 

생성자 & 소멸자 문서화

◆ UGameCheatManager()

UGameCheatManager::UGameCheatManager ( )
19{
20 static ConstructorHelpers::FClassFinder<UGameplayEffect> DeathEffect(TEXT("/Game/CK_UE/GAS/GE/Debug/BPGE_DebugKillPlayer"));
21 InstantDeathEffectClass = DeathEffect.Class;
22}
TSubclassOf< UGameplayEffect > InstantDeathEffectClass
Definition GameCheatManager.h:56

다음을 참조함 : InstantDeathEffectClass.

멤버 함수 문서화

◆ ApplyInstantDeath()

bool UGameCheatManager::ApplyInstantDeath ( AActor *  Target) const
private
45{
46 if (IsValid(Target) == false || InstantDeathEffectClass == nullptr)
47 {
48 return false;
49 }
50
51 UAbilitySystemComponent* AbilitySystem = UAbilitySystemBlueprintLibrary::GetAbilitySystemComponent(Target);
52 const UBaseAttributeSet* Attributes = AbilitySystem ? AbilitySystem->GetSet<UBaseAttributeSet>() : nullptr;
53 if (Attributes == nullptr || Attributes->IsOutOfHealth())
54 {
55 return false;
56 }
57
58 FGameplayEffectContextHandle Context = AbilitySystem->MakeEffectContext();
59 Context.AddInstigator(GetPlayerController()->GetPawn(), GetPlayerController()->GetPawn());
60 AbilitySystem->ApplyGameplayEffectToSelf(InstantDeathEffectClass->GetDefaultObject<UGameplayEffect>(), 1.0f, Context);
61 return Attributes->IsOutOfHealth();
62}
Definition BaseAttributeSet.h:58
FORCEINLINE bool IsOutOfHealth() const
Definition BaseAttributeSet.h:88

다음을 참조함 : InstantDeathEffectClass, UBaseAttributeSet::IsOutOfHealth().

다음에 의해서 참조됨 : Kill(), Suicide().

이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:
이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ ApplyPlayerHealthDamage()

void UGameCheatManager::ApplyPlayerHealthDamage ( float  DamageAmount)
private

즉시 GameplayEffect로 체력을 차감해 기존 체력 제한과 사망 처리를 거친다.

86{
87 if (CanExecuteCheat() == false)
88 {
89 return;
90 }
91
92 APawn* PlayerPawn = GetPlayerController()->GetPawn();
93 UAbilitySystemComponent* AbilitySystem = UAbilitySystemBlueprintLibrary::GetAbilitySystemComponent(PlayerPawn);
94 const UBaseAttributeSet* Attributes = AbilitySystem ? AbilitySystem->GetSet<UBaseAttributeSet>() : nullptr;
95 if (Attributes == nullptr || Attributes->IsOutOfHealth())
96 {
97 GetPlayerController()->ClientMessage(TEXT("dmg: no living player."));
98 return;
99 }
100
101 UGameplayEffect* DamageEffect = NewObject<UGameplayEffect>(this);
102 DamageEffect->DurationPolicy = EGameplayEffectDurationType::Instant;
103 FGameplayModifierInfo& Modifier = DamageEffect->Modifiers.AddDefaulted_GetRef();
104 Modifier.Attribute = UBaseAttributeSet::GetHealthAttribute();
105 Modifier.ModifierOp = EGameplayModOp::Additive;
106 Modifier.ModifierMagnitude = FScalableFloat(-DamageAmount);
107
108 FGameplayEffectContextHandle Context = AbilitySystem->MakeEffectContext();
109 Context.AddInstigator(PlayerPawn, PlayerPawn);
110 AbilitySystem->ApplyGameplayEffectToSelf(DamageEffect, 1.0f, Context);
111}
bool CanExecuteCheat() const
Definition GameCheatManager.cpp:34

다음을 참조함 : CanExecuteCheat(), UBaseAttributeSet::IsOutOfHealth().

다음에 의해서 참조됨 : Dmg1000(), Dmg500().

이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:
이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ CanExecuteCheat()

bool UGameCheatManager::CanExecuteCheat ( ) const
private
35{
36#if UE_BUILD_SHIPPING
37 return false;
38#else
39 const APlayerController* Controller = GetPlayerController();
40 return Controller && Controller->IsLocalController() && Controller->HasAuthority();
41#endif
42}

다음에 의해서 참조됨 : ApplyPlayerHealthDamage(), ClearPower(), Kill(), Power(), Suicide().

이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ ClearPower()

void UGameCheatManager::ClearPower ( )
148{
149 if (CanExecuteCheat() == false)
150 {
151 return;
152 }
153
155 GetPlayerController()->ClientMessage(TEXT("ClearPower: Attack bonus cleared."));
156}
void RemovePowerEffect()
Definition GameCheatManager.cpp:158

다음을 참조함 : CanExecuteCheat(), RemovePowerEffect().

이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:

◆ Dmg1000()

void UGameCheatManager::Dmg1000 ( )

피해 배율과 무관하게 플레이어 체력을 1000 차감한다.

81{
83}
void ApplyPlayerHealthDamage(float DamageAmount)
Definition GameCheatManager.cpp:85

다음을 참조함 : ApplyPlayerHealthDamage().

이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:

◆ Dmg500()

void UGameCheatManager::Dmg500 ( )

피해 배율과 무관하게 플레이어 체력을 500 차감한다.

76{
78}

다음을 참조함 : ApplyPlayerHealthDamage().

이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:

◆ InitCheatManager()

void UGameCheatManager::InitCheatManager ( )
overridevirtual
25{
26 Super::InitCheatManager();
27
28 if (APlayerController* Controller = GetPlayerController())
29 {
30 Controller->OnPossessedPawnChanged.AddUniqueDynamic(this, &ThisClass::OnPossessedPawnChanged);
31 }
32}

◆ Kill()

void UGameCheatManager::Kill ( )
183{
184 if (CanExecuteCheat() == false)
185 {
186 return;
187 }
188
189 UStageSubsystem* Stage = GetWorld()->GetSubsystem<UStageSubsystem>();
190 ASpawnHub* Hub = Stage ? Stage->GetSpawnHub() : nullptr;
191 TArray<TWeakObjectPtr<AEnemyCharacterBase>> Targets;
192 if (IsValid(Hub))
193 {
194 // 사망 알림으로 스폰 목록이나 웨이브가 바뀌기 전에 모든 대상을 확정한다.
195 for (UEnemySpawnDirectorSystemComponent* SpawnSystem : Hub->GetRegisteredSpawnSystems<UEnemySpawnDirectorSystemComponent>())
196 {
197 for (AEnemyCharacterBase* Enemy : SpawnSystem->GetAllSpawnedEnemies())
198 {
199 if (IsValid(Enemy) && Enemy->IsDead() == false)
200 {
201 Targets.AddUnique(Enemy);
202 }
203 }
204 }
205 }
206
207 int32 KilledCount = 0;
208 for (const TWeakObjectPtr<AEnemyCharacterBase>& Target : Targets)
209 {
210 if (ApplyInstantDeath(Target.Get()))
211 {
212 ++KilledCount;
213 }
214 }
215
216 GetPlayerController()->ClientMessage(FString::Printf(TEXT("kill: %d enemies killed."), KilledCount));
217}
Definition EnemyCharacterBase.h:48
Definition SpawnHub.h:27
Definition EnemySpawnDirectorSystemComponent.h:75
bool ApplyInstantDeath(AActor *Target) const
Definition GameCheatManager.cpp:44
Definition StageSubsystem.h:102
FORCEINLINE ASpawnHub * GetSpawnHub() const
Definition StageSubsystem.h:189

다음을 참조함 : ApplyInstantDeath(), CanExecuteCheat(), UStageSubsystem::GetSpawnHub().

이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:

◆ OnPossessedPawnChanged()

void UGameCheatManager::OnPossessedPawnChanged ( APawn *  OldPawn,
APawn *  NewPawn 
)
private
175{
176 if (OldPawn != NewPawn)
177 {
179 }
180}

다음을 참조함 : RemovePowerEffect().

이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:

◆ Power()

void UGameCheatManager::Power ( )
114{
115 if (CanExecuteCheat() == false)
116 {
117 return;
118 }
119
120 UAbilitySystemComponent* AbilitySystem = UAbilitySystemBlueprintLibrary::GetAbilitySystemComponent(GetPlayerController()->GetPawn());
121 const UBaseAttributeSet* Attributes = AbilitySystem ? AbilitySystem->GetSet<UBaseAttributeSet>() : nullptr;
122 if (Attributes == nullptr || Attributes->IsOutOfHealth())
123 {
124 GetPlayerController()->ClientMessage(TEXT("power: no living player."));
125 return;
126 }
127
128 if (PowerAbilitySystem.Get() == AbilitySystem && AbilitySystem->GetActiveGameplayEffect(PowerEffectHandle))
129 {
130 GetPlayerController()->ClientMessage(TEXT("power: +10000 Attack is already active."));
131 return;
132 }
133
135 PowerEffectHandle = AbilitySystem->ApplyGameplayEffectToSelf(GetDefault<UGE_DebugPower>(), 1.0f, AbilitySystem->MakeEffectContext());
136 if (PowerEffectHandle.IsValid() == false)
137 {
138 GetPlayerController()->ClientMessage(TEXT("power: failed to apply Attack bonus."));
139 return;
140 }
141
142 PowerAbilitySystem = AbilitySystem;
143 Attributes->OnDeathDelegate.AddUniqueDynamic(this, &ThisClass::RemovePowerEffect);
144 GetPlayerController()->ClientMessage(TEXT("power: +10000 Attack applied."));
145}
FDeathDelegate OnDeathDelegate
Definition BaseAttributeSet.h:99
FActiveGameplayEffectHandle PowerEffectHandle
Definition GameCheatManager.h:61
TWeakObjectPtr< UAbilitySystemComponent > PowerAbilitySystem
Definition GameCheatManager.h:59

다음을 참조함 : CanExecuteCheat(), UBaseAttributeSet::IsOutOfHealth(), UBaseAttributeSet::OnDeathDelegate, PowerAbilitySystem, PowerEffectHandle, RemovePowerEffect().

이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:

◆ RemovePowerEffect()

void UGameCheatManager::RemovePowerEffect ( )
private
159{
160 if (UAbilitySystemComponent* AbilitySystem = PowerAbilitySystem.Get())
161 {
162 if (const UBaseAttributeSet* Attributes = AbilitySystem->GetSet<UBaseAttributeSet>())
163 {
164 Attributes->OnDeathDelegate.RemoveDynamic(this, &ThisClass::RemovePowerEffect);
165 }
166
167 AbilitySystem->RemoveActiveGameplayEffect(PowerEffectHandle);
168 }
169
170 PowerEffectHandle.Invalidate();
171 PowerAbilitySystem.Reset();
172}

다음을 참조함 : PowerAbilitySystem, PowerEffectHandle.

다음에 의해서 참조됨 : ClearPower(), OnPossessedPawnChanged(), Power().

이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ Suicide()

void UGameCheatManager::Suicide ( )
65{
66 if (CanExecuteCheat() == false)
67 {
68 return;
69 }
70
71 const bool bDied = ApplyInstantDeath(GetPlayerController()->GetPawn());
72 GetPlayerController()->ClientMessage(bDied ? TEXT("Suicide: player killed.") : TEXT("Suicide: no living player to kill."));
73}

다음을 참조함 : ApplyInstantDeath(), CanExecuteCheat().

이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:

멤버 데이터 문서화

◆ InstantDeathEffectClass

TSubclassOf<UGameplayEffect> UGameCheatManager::InstantDeathEffectClass
private

다음에 의해서 참조됨 : ApplyInstantDeath(), UGameCheatManager().

◆ PowerAbilitySystem

TWeakObjectPtr<UAbilitySystemComponent> UGameCheatManager::PowerAbilitySystem
private

다음에 의해서 참조됨 : Power(), RemovePowerEffect().

◆ PowerEffectHandle

FActiveGameplayEffectHandle UGameCheatManager::PowerEffectHandle
private

다음에 의해서 참조됨 : Power(), RemovePowerEffect().


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