37{
38
39 ACharacter* Character = Cast<ACharacter>(ActorInfo->AvatarActor.Get());
40 if (!Character)
41 {
42 EndAbility(Handle, ActorInfo, ActivationInfo,
false,
true);
43 return;
44 }
45
46 UAbilitySystemComponent* ASC = GetAbilitySystemComponentFromActorInfo();
47
48 if (!ASC)
49 {
50 EndAbility(Handle, ActorInfo, ActivationInfo,
false,
true);
51 return;
52 }
53
55 {
57 EndAbility(Handle, ActorInfo, ActivationInfo,
false,
true);
58 return;
59 }
60
62 {
63 LOG_ERROR(LogCK,
"Charge 스킬 InstantAttackMontages 배열이 비어있음");
64 EndAbility(Handle, ActorInfo, ActivationInfo,
false,
true);
65 return;
66 }
67
68 if (!CommitAbility(Handle, ActorInfo, ActivationInfo))
69 {
70 EndAbility(Handle, ActorInfo, ActivationInfo,
true,
true);
71 return;
72 }
73
75
76 IChargeInterface* ChargeInterface = Cast<IChargeInterface>(GetAvatarActorFromActorInfo());
77 if (ChargeInterface)
78 {
80 }
81
83
84
86
87 ASC->AddGameplayCue(TAG_CUE_CHARGE_AURA);
88 ASC->AddLooseGameplayTag(TAG_CHARACTER_STATE_COMBAT_ISCHARGING);
91
92
94 TArray<FChargePhaseTableRow*> Rows;
97 {
98 if (R)
99 {
101 }
102 }
104 {
106 });
107
109 {
110 LOG_ERROR(LogCK,
"ChargePhaseTable이 비어있음");
111 EndAbility(Handle, ActorInfo, ActivationInfo,
false,
true);
112 return;
113 }
114
116
117
118 TArray<float> PhaseDurations;
120
121 float PrevTime = 0.0f;
123 {
124 const float Duration = FMath::Max(Row.Charge_Time - PrevTime, 0.0f);
125 PhaseDurations.Add(Duration);
126 PrevTime = Row.Charge_Time;
127 }
128
129 UWorld* World = GetWorld();
130 if (!World)
131 {
132 EndAbility(Handle, ActorInfo, ActivationInfo,
false,
true);
133 return;
134 }
135
136 FTimerManager& TimerManager = World->GetTimerManager();
137
139 {
141 if (Time <= 0.f)
142 {
143 continue;
144 }
145
146 const int32 PhaseNumber = i + 1;
147 FTimerHandle Handle_Phase;
148 TimerManager.SetTimer(Handle_Phase, FTimerDelegate::CreateUObject(this, &ThisClass::OnPhaseReached, PhaseNumber), Time, false);
150 }
151
152
154
155
156 if (ChargeInterface)
157 {
159 {
160 StateComp->BeginCharge(PhaseDurations);
161 }
162 }
163}
#define LOG_ERROR(Category, Format,...)
Definition CK_UE.h:40
Definition ChargeInterface.h:21
virtual UChargeStateComponent * GetChargeStateComponent() const =0
virtual void OnChargeBegin()=0
void SetupCancelableListener()
Definition GA_Base.cpp:53
void ApplyEffectsToSelf(const FGameplayAbilitySpecHandle Handle, const FGameplayAbilityActorInfo *ActorInfo, const FGameplayAbilityActivationInfo ActivationInfo)
Definition GA_CombatBase.cpp:265
TObjectPtr< UDataTable > ChargePhaseTable
Definition GA_Skill_Charge.h:59
TArray< FChargePhaseTableRow > CachedPhaseRows
Definition GA_Skill_Charge.h:67
TArray< TObjectPtr< UAnimMontage > > AttackMontages
Definition GA_Skill_Charge.h:62
bool bShouldApplyCooldownOnEnd
Definition GA_Skill_Charge.h:78
TArray< FTimerHandle > PhaseDelayTimers
Definition GA_Skill_Charge.h:72
void ApplyChargePhaseEffects(int32 PhaseIndex)
Definition GA_Skill_Charge.cpp:190
bool bChargeStateActive
Definition GA_Skill_Charge.h:75
void StartChargeLoopAudio()
Definition GA_Skill_Charge.cpp:250
virtual void EndAbility(const FGameplayAbilitySpecHandle Handle, const FGameplayAbilityActorInfo *ActorInfo, const FGameplayAbilityActivationInfo ActivationInfo, bool bReplicateEndAbility, bool bWasCancelled) override
Definition GA_Skill_Charge.cpp:341
int32 CurrentPhase
Definition GA_Skill_Charge.h:70
Definition ChargeTable.h:13
float Charge_Time
Definition ChargeTable.h:22