#include <GA_CombatBase.h>
|
| | UGA_CombatBase () |
| |
| virtual void | OnGiveAbility (const FGameplayAbilityActorInfo *ActorInfo, const FGameplayAbilitySpec &Spec) override |
| |
| virtual void | EndAbility (const FGameplayAbilitySpecHandle Handle, const FGameplayAbilityActorInfo *ActorInfo, const FGameplayAbilityActivationInfo ActivationInfo, bool bReplicateEndAbility, bool bWasCancelled) override |
| |
| FORCEINLINE bool | GetHitStopEnable () const |
| |
| | UGA_Base () |
| |
◆ UGA_CombatBase()
| UGA_CombatBase::UGA_CombatBase |
( |
| ) |
|
◆ ApplyCombatData()
| void UGA_CombatBase::ApplyCombatData |
( |
| ) |
|
|
protectedvirtual |
UGA_EnemyAttack, UGA_Attack, UGA_Skill_Q, UGA_SkillBase에서 재구현되었습니다.
25{
27 {
28 return;
29 }
30
42}
uint8 bApplyKnockback
Definition GA_CombatBase.h:91
uint8 bApplyHitStop
Definition GA_CombatBase.h:100
TSubclassOf< ATA_Trace > HitTraceClass
Definition GA_CombatBase.h:75
float KnockbackZComponent
Definition GA_CombatBase.h:97
TEnumAsByte< ECollisionChannel > TraceChannel
Definition GA_CombatBase.h:87
TObjectPtr< UCombatDataBase > CombatData
Definition GA_CombatBase.h:68
float HitStopTimeDilation
Definition GA_CombatBase.h:106
float HitStopDuration
Definition GA_CombatBase.h:103
float KnockbackStrength
Definition GA_CombatBase.h:94
FGameplayTag HitCheckStartTag
Definition GA_CombatBase.h:81
TArray< TSubclassOf< UGameplayEffect > > TargetEffectClasses
Definition GA_CombatBase.h:78
FGameplayTag HitCheckEndTag
Definition GA_CombatBase.h:84
◆ ApplyEffectsToTargets()
| void UGA_CombatBase::ApplyEffectsToTargets |
( |
const TArray< AActor * > & |
TargetActors, |
|
|
float |
CurrentLevel |
|
) |
| |
|
protected |
193{
195 {
196 return;
197 }
198
199 FGameplayAbilityTargetData_ActorArray* NewData = new FGameplayAbilityTargetData_ActorArray();
200 NewData->TargetActorArray.Append(TargetActors);
201 FGameplayAbilityTargetDataHandle FilteredHandle(NewData);
202
204 {
205 if (!EffectClass)
206 {
207 continue;
208 }
209
210 FGameplayEffectSpecHandle EffectSpecHandle = MakeOutgoingGameplayEffectSpec(EffectClass, CurrentLevel);
211 if (EffectSpecHandle.IsValid())
212 {
213 (void)ApplyGameplayEffectSpecToTarget(CurrentSpecHandle, CurrentActorInfo, CurrentActivationInfo, EffectSpecHandle, FilteredHandle);
214 }
215 }
216}
◆ ApplyGlobalHitStop()
| void UGA_CombatBase::ApplyGlobalHitStop |
( |
| ) |
|
|
protected |
233{
234 if (UWorld* World = GetWorld())
235 {
237 World->GetTimerManager().SetTimer(
239 this,
240 &ThisClass::RestoreTimeDilation,
242 false);
243 }
244}
FTimerHandle HitStopTimerHandle
Definition GA_CombatBase.h:110
◆ ApplyKnockbackToTargets()
| void UGA_CombatBase::ApplyKnockbackToTargets |
( |
const TArray< AActor * > & |
TargetActors, |
|
|
AActor * |
Attacker |
|
) |
| |
|
protected |
219{
220 for (AActor* Target : TargetActors)
221 {
222 if (ACharacter* TargetCharacter = Cast<ACharacter>(Target))
223 {
224 FVector KnockbackDir = (TargetCharacter->GetActorLocation() - Attacker->GetActorLocation()).GetSafeNormal();
226
228 }
229 }
230}
◆ EndAbility()
| void UGA_CombatBase::EndAbility |
( |
const FGameplayAbilitySpecHandle |
Handle, |
|
|
const FGameplayAbilityActorInfo * |
ActorInfo, |
|
|
const FGameplayAbilityActivationInfo |
ActivationInfo, |
|
|
bool |
bReplicateEndAbility, |
|
|
bool |
bWasCancelled |
|
) |
| |
|
overridevirtual |
UGA_EnemyAttack, UGA_Attack에서 재구현되었습니다.
45{
47 {
50 }
51
52 if (UWorld* World = GetWorld())
53 {
55 {
58 }
59 }
60
61 Super::EndAbility(Handle, ActorInfo, ActivationInfo, bReplicateEndAbility, bWasCancelled);
62}
TObjectPtr< UAT_Trace > ActiveTraceTask
Definition GA_CombatBase.h:72
void RestoreTimeDilation()
Definition GA_CombatBase.cpp:246
◆ GetHitStopEnable()
| FORCEINLINE bool UGA_CombatBase::GetHitStopEnable |
( |
| ) |
const |
|
inline |
◆ GetValidTargets()
| void UGA_CombatBase::GetValidTargets |
( |
const FGameplayAbilityTargetDataHandle & |
TargetDataHandle, |
|
|
TArray< AActor * > & |
OutValidActors |
|
) |
| const |
|
protected |
165{
166 for (const TSharedPtr<FGameplayAbilityTargetData>& Data : TargetDataHandle.Data)
167 {
168 if (!Data.IsValid())
169 {
170 continue;
171 }
172
173 for (const TWeakObjectPtr<AActor>& TargetPtr : Data->GetActors())
174 {
175 AActor* Target = TargetPtr.Get();
176 if (!Target)
177 {
178 continue;
179 }
180
181 UAbilitySystemComponent* TargetASC = UAbilitySystemBlueprintLibrary::GetAbilitySystemComponent(Target);
182 if (!TargetASC || TargetASC->HasMatchingGameplayTag(TAG_CHARACTER_STATE_ISDEAD))
183 {
184 continue;
185 }
186
187 OutValidActors.AddUnique(Target);
188 }
189 }
190}
◆ OnGiveAbility()
| void UGA_CombatBase::OnGiveAbility |
( |
const FGameplayAbilityActorInfo * |
ActorInfo, |
|
|
const FGameplayAbilitySpec & |
Spec |
|
) |
| |
|
overridevirtual |
19{
20 Super::OnGiveAbility(ActorInfo, Spec);
22}
virtual void ApplyCombatData()
Definition GA_CombatBase.cpp:24
◆ OnHitCheckEnd()
| void UGA_CombatBase::OnHitCheckEnd |
( |
FGameplayEventData |
Payload | ) |
|
|
protected |
◆ OnHitCheckStart()
| void UGA_CombatBase::OnHitCheckStart |
( |
FGameplayEventData |
Payload | ) |
|
|
protected |
90{
92 {
95 }
96
99 {
100 ActiveTraceTask->OnCompleteDelegate.AddDynamic(
this, &ThisClass::OnTraceResultCallback);
102 }
103}
static UAT_Trace * CreateTask(UGameplayAbility *OwningAbility, TSubclassOf< ATA_Trace > TargetActorClass, float InCurrentLevel, ECollisionChannel InTraceChannel=ECC_GameTraceChannel1, bool bInSingleTrace=false)
Definition AT_Trace.cpp:13
◆ OnSingleHitCheck()
| void UGA_CombatBase::OnSingleHitCheck |
( |
FGameplayEventData |
Payload | ) |
|
|
protected |
115{
117 {
120 }
121
124 {
125 ActiveTraceTask->OnCompleteDelegate.AddDynamic(
this, &ThisClass::OnTraceResultCallback);
127 }
128}
◆ OnTraceResultCallback()
| void UGA_CombatBase::OnTraceResultCallback |
( |
const FGameplayAbilityTargetDataHandle & |
TargetDataHandle, |
|
|
float |
CurrentLevel |
|
) |
| |
|
protected |
131{
132 if (TargetDataHandle.Data.IsEmpty())
133 {
134 return;
135 }
136
137 AActor* Attacker = GetAvatarActorFromActorInfo();
138 TArray<AActor*> ValidLivingActors;
139
140
142
143 if (ValidLivingActors.IsEmpty())
144 {
145 return;
146 }
147
148
150
151
153 {
155 }
156
157
159 {
161 }
162}
void ApplyKnockbackToTargets(const TArray< AActor * > &TargetActors, AActor *Attacker)
Definition GA_CombatBase.cpp:218
void ApplyEffectsToTargets(const TArray< AActor * > &TargetActors, float CurrentLevel)
Definition GA_CombatBase.cpp:192
void ApplyGlobalHitStop()
Definition GA_CombatBase.cpp:232
void GetValidTargets(const FGameplayAbilityTargetDataHandle &TargetDataHandle, TArray< AActor * > &OutValidActors) const
Definition GA_CombatBase.cpp:164
◆ RestoreTimeDilation()
| void UGA_CombatBase::RestoreTimeDilation |
( |
| ) |
|
|
private |
247{
248 if (UWorld* World = GetWorld())
249 {
250 UGameplayStatics::SetGlobalTimeDilation(World, 1.0f);
251 }
252}
◆ SetHitStopEnabled()
| FORCEINLINE void UGA_CombatBase::SetHitStopEnabled |
( |
bool |
bEnable | ) |
|
|
inlineprotected |
◆ SetupHitCheckListeners()
| void UGA_CombatBase::SetupHitCheckListeners |
( |
| ) |
|
|
protected |
65{
66
67 if (UAbilityTask_WaitGameplayEvent* WaitStart = UAbilityTask_WaitGameplayEvent::WaitGameplayEvent(
this,
HitCheckStartTag,
nullptr,
false,
false))
68 {
69 WaitStart->EventReceived.AddDynamic(this, &ThisClass::OnHitCheckStart);
70 WaitStart->ReadyForActivation();
71 }
72
73 if (UAbilityTask_WaitGameplayEvent* WaitEnd = UAbilityTask_WaitGameplayEvent::WaitGameplayEvent(
this,
HitCheckEndTag,
nullptr,
false,
false))
74 {
75 WaitEnd->EventReceived.AddDynamic(this, &ThisClass::OnHitCheckEnd);
76 WaitEnd->ReadyForActivation();
77 }
78}
◆ SetupSingleHitCheckListener()
| void UGA_CombatBase::SetupSingleHitCheckListener |
( |
| ) |
|
|
protected |
81{
82 if (UAbilityTask_WaitGameplayEvent* WaitStart = UAbilityTask_WaitGameplayEvent::WaitGameplayEvent(
this,
HitCheckStartTag,
nullptr,
false,
false))
83 {
84 WaitStart->EventReceived.AddDynamic(this, &ThisClass::OnSingleHitCheck);
85 WaitStart->ReadyForActivation();
86 }
87}
◆ ActiveTraceTask
| TObjectPtr<UAT_Trace> UGA_CombatBase::ActiveTraceTask |
|
protected |
◆ bApplyHitStop
| uint8 UGA_CombatBase::bApplyHitStop |
|
protected |
◆ bApplyKnockback
| uint8 UGA_CombatBase::bApplyKnockback |
|
protected |
◆ CombatData
◆ HitCheckEndTag
| FGameplayTag UGA_CombatBase::HitCheckEndTag |
|
protected |
◆ HitCheckStartTag
| FGameplayTag UGA_CombatBase::HitCheckStartTag |
|
protected |
◆ HitStopDuration
| float UGA_CombatBase::HitStopDuration = 0.05f |
|
protected |
◆ HitStopTimeDilation
| float UGA_CombatBase::HitStopTimeDilation = 0.1f |
|
protected |
◆ HitStopTimerHandle
| FTimerHandle UGA_CombatBase::HitStopTimerHandle |
|
private |
◆ HitTraceClass
| TSubclassOf<ATA_Trace> UGA_CombatBase::HitTraceClass |
|
protected |
◆ KnockbackStrength
| float UGA_CombatBase::KnockbackStrength = 700.0f |
|
protected |
◆ KnockbackZComponent
| float UGA_CombatBase::KnockbackZComponent = 0.2f |
|
protected |
◆ TargetEffectClasses
| TArray<TSubclassOf<UGameplayEffect> > UGA_CombatBase::TargetEffectClasses |
|
protected |
◆ TraceChannel
| TEnumAsByte<ECollisionChannel> UGA_CombatBase::TraceChannel |
|
protected |
이 클래스에 대한 문서화 페이지는 다음의 파일들로부터 생성되었습니다.: