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

#include <AT_EnemyDashMove.h>

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

Public 멤버 함수

 UAT_EnemyDashMove ()
 
virtual void Activate () override
 
virtual void TickTask (float DeltaTime) override
 
virtual void OnDestroy (bool bInOwnerFinished) override
 

정적 Public 멤버 함수

static UAT_EnemyDashMoveEnemyDashMove (UGameplayAbility *OwningAbility, UBoxComponent *InDashHitBoxComponent, const FVector &InDashDirection, float InDashSpeed, float InMaxDistance, ECollisionChannel InHitTraceChannel)
 

Public 속성

FEnemyDashMoveHitSignature OnTargetHit
 
FEnemyDashMoveSignature OnFinished
 

Protected 멤버 함수

bool SweepDashHit (const FVector &StartLocation, const FVector &EndLocation, FHitResult &OutHitResult) const
 
void FinishDash ()
 
void BroadcastTargetHit (const FHitResult &HitResult)
 

Protected 속성

TObjectPtr< ACharacter > OwnerCharacter
 
TObjectPtr< UCharacterMovementComponent > MovementComponent
 
TObjectPtr< UCapsuleComponent > CapsuleComponent
 
TObjectPtr< UBoxComponent > DashHitBoxComponent
 
TObjectPtr< UCharacterMovementComponentBase > RotationComponent
 
FVector DashDirection = FVector::ZeroVector
 
float DashSpeed = 0.0f
 
float MaxDistance = 0.0f
 
float MovedDistance = 0.0f
 
ECollisionChannel HitTraceChannel = ECC_Pawn
 
ECollisionResponse CachedPawnCollisionResponse = ECR_Block
 
bool bDashEnded = false
 

생성자 & 소멸자 문서화

◆ UAT_EnemyDashMove()

UAT_EnemyDashMove::UAT_EnemyDashMove ( )
14{
15 bTickingTask = true;
16}

멤버 함수 문서화

◆ Activate()

void UAT_EnemyDashMove::Activate ( )
overridevirtual
37{
38 Super::Activate();
39
40 OwnerCharacter = Cast<ACharacter>(GetAvatarActor());
41 if (OwnerCharacter == nullptr)
42 {
43 EndTask();
44 return;
45 }
46
47 MovementComponent = OwnerCharacter->GetCharacterMovement();
48 if (MovementComponent == nullptr || DashDirection.IsNearlyZero() || DashSpeed <= KINDA_SMALL_NUMBER || MaxDistance <= KINDA_SMALL_NUMBER)
49 {
50 FinishDash();
51 return;
52 }
53
54 UCharacterMovementComponentBase* FoundRotationComponent = Cast<UCharacterMovementComponentBase>(MovementComponent);
55
56 if (IsValid(FoundRotationComponent) == false)
57 {
58 FinishDash();
59 return;
60 }
61
62 UCapsuleComponent* FoundCapsuleComponent = OwnerCharacter->GetCapsuleComponent();
63 if (IsValid(FoundCapsuleComponent) == false)
64 {
65 FinishDash();
66 return;
67 }
68
69 if (IsValid(DashHitBoxComponent) == false)
70 {
71 FinishDash();
72 return;
73 }
74
75 CapsuleComponent = FoundCapsuleComponent;
76 RotationComponent = FoundRotationComponent;
77 CachedPawnCollisionResponse = CapsuleComponent->GetCollisionResponseToChannel(ECC_Pawn);
78 CapsuleComponent->SetCollisionResponseToChannel(ECC_Pawn, ECR_Ignore);
79 RotationComponent->BeginManualRotation();
80 MovementComponent->Velocity = FVector::ZeroVector;
81 OwnerCharacter->SetActorRotation(DashDirection.Rotation());
82}
FVector DashDirection
Definition AT_EnemyDashMove.h:61
float MaxDistance
Definition AT_EnemyDashMove.h:63
TObjectPtr< UCharacterMovementComponentBase > RotationComponent
Definition AT_EnemyDashMove.h:59
TObjectPtr< UBoxComponent > DashHitBoxComponent
Definition AT_EnemyDashMove.h:56
void FinishDash()
Definition AT_EnemyDashMove.cpp:205
TObjectPtr< UCharacterMovementComponent > MovementComponent
Definition AT_EnemyDashMove.h:50
ECollisionResponse CachedPawnCollisionResponse
Definition AT_EnemyDashMove.h:66
TObjectPtr< ACharacter > OwnerCharacter
Definition AT_EnemyDashMove.h:47
TObjectPtr< UCapsuleComponent > CapsuleComponent
Definition AT_EnemyDashMove.h:53
float DashSpeed
Definition AT_EnemyDashMove.h:62
이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:

◆ BroadcastTargetHit()

void UAT_EnemyDashMove::BroadcastTargetHit ( const FHitResult &  HitResult)
protected
223{
224 if (bDashEnded)
225 {
226 return;
227 }
228
229 bDashEnded = true;
230
231 if (ShouldBroadcastAbilityTaskDelegates())
232 {
233 OnTargetHit.Broadcast(HitResult);
234 }
235
236 EndTask();
237}
bool bDashEnded
Definition AT_EnemyDashMove.h:68
FEnemyDashMoveHitSignature OnTargetHit
Definition AT_EnemyDashMove.h:41
이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ EnemyDashMove()

UAT_EnemyDashMove * UAT_EnemyDashMove::EnemyDashMove ( UGameplayAbility *  OwningAbility,
UBoxComponent *  InDashHitBoxComponent,
const FVector &  InDashDirection,
float  InDashSpeed,
float  InMaxDistance,
ECollisionChannel  InHitTraceChannel 
)
static
21{
22 UAT_EnemyDashMove* NewTask = NewAbilityTask<UAT_EnemyDashMove>(OwningAbility);
23
24 FVector SafeDirection = InDashDirection;
25 SafeDirection.Z = 0.0f;
26
27 NewTask->DashDirection = SafeDirection.GetSafeNormal();
28 NewTask->DashHitBoxComponent = InDashHitBoxComponent;
29 NewTask->DashSpeed = InDashSpeed;
30 NewTask->MaxDistance = InMaxDistance;
31 NewTask->HitTraceChannel = InHitTraceChannel;
32
33 return NewTask;
34}
Definition AT_EnemyDashMove.h:23
ECollisionChannel HitTraceChannel
Definition AT_EnemyDashMove.h:65
이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ FinishDash()

void UAT_EnemyDashMove::FinishDash ( )
protected
206{
207 if (bDashEnded)
208 {
209 return;
210 }
211
212 bDashEnded = true;
213
214 if (ShouldBroadcastAbilityTaskDelegates())
215 {
216 OnFinished.Broadcast();
217 }
218
219 EndTask();
220}
FEnemyDashMoveSignature OnFinished
Definition AT_EnemyDashMove.h:43
이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ OnDestroy()

void UAT_EnemyDashMove::OnDestroy ( bool  bInOwnerFinished)
overridevirtual
147{
148 if (IsValid(CapsuleComponent))
149 {
150 CapsuleComponent->SetCollisionResponseToChannel(ECC_Pawn, CachedPawnCollisionResponse);
151 }
152 CapsuleComponent = nullptr;
153 DashHitBoxComponent = nullptr;
154
155 if (IsValid(RotationComponent))
156 {
157 RotationComponent->EndManualRotation();
158 }
159 RotationComponent = nullptr;
160
162 {
163 MovementComponent->Velocity = FVector::ZeroVector;
164 }
165
166 Super::OnDestroy(bInOwnerFinished);
167}

◆ SweepDashHit()

bool UAT_EnemyDashMove::SweepDashHit ( const FVector &  StartLocation,
const FVector &  EndLocation,
FHitResult &  OutHitResult 
) const
protected
170{
171 if (OwnerCharacter == nullptr || IsValid(DashHitBoxComponent) == false)
172 {
173 return false;
174 }
175
176 const FVector HitBoxExtent = DashHitBoxComponent->GetScaledBoxExtent();
177 if (HitBoxExtent.IsNearlyZero())
178 {
179 return false;
180 }
181
182 UWorld* World = GetWorld();
183 if (World == nullptr)
184 {
185 return false;
186 }
187
188 FCollisionQueryParams QueryParams(SCENE_QUERY_STAT(EnemyDashMoveHit), false, OwnerCharacter);
189 QueryParams.AddIgnoredActor(OwnerCharacter);
190
191 const FCollisionShape HitShape = FCollisionShape::MakeBox(HitBoxExtent);
192 const FQuat HitRotation = DashHitBoxComponent->GetComponentQuat();
193
194 TArray<FHitResult> HitResults;
195 World->SweepMultiByChannel(HitResults, StartLocation, EndLocation, HitRotation, HitTraceChannel, HitShape, QueryParams);
196 if (HitResults.IsEmpty())
197 {
198 return false;
199 }
200
201 OutHitResult = HitResults[0];
202 return true;
203}
이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ TickTask()

void UAT_EnemyDashMove::TickTask ( float  DeltaTime)
overridevirtual
85{
86 Super::TickTask(DeltaTime);
87
88 if (bDashEnded)
89 {
90 return;
91 }
92
93 if (OwnerCharacter == nullptr || MovementComponent == nullptr || IsValid(DashHitBoxComponent) == false)
94 {
95 FinishDash();
96 return;
97 }
98
99 const float RemainingDistance = MaxDistance - MovedDistance;
100 if (RemainingDistance <= KINDA_SMALL_NUMBER)
101 {
102 FinishDash();
103 return;
104 }
105
106 const FVector StartLocation = OwnerCharacter->GetActorLocation();
107 const FVector SweepStartLocation = DashHitBoxComponent->GetComponentLocation();
108 const float StepDistance = FMath::Min(DashSpeed * DeltaTime, RemainingDistance);
109 const FVector Delta = DashDirection * StepDistance;
110
111 // 1) 이동 전에 이번 스텝 경로로 타겟을 먼저 판정한다.
112 FHitResult DashHitResult;
113 const bool bWillHitTarget = SweepDashHit(SweepStartLocation, SweepStartLocation + Delta, DashHitResult);
114
115 // 2) 타겟에 맞으면 접촉 지점까지만 이동해 오버슈트를 방지한다.
116 const float MoveFraction = bWillHitTarget ? FMath::Clamp(DashHitResult.Time, 0.0f, 1.0f) : 1.0f;
117 const FVector AppliedDelta = Delta * MoveFraction;
118
119 FHitResult MoveHitResult;
120 MovementComponent->SafeMoveUpdatedComponent(AppliedDelta, OwnerCharacter->GetActorQuat(), true, MoveHitResult);
121 MovementComponent->Velocity = FVector::ZeroVector;
122
123 const FVector EndLocation = OwnerCharacter->GetActorLocation();
124 MovedDistance += FVector::Dist2D(StartLocation, EndLocation);
125
126 // 3) 벽에 먼저 막혔다면(타겟보다 가까운 벽) 벽 정지를 우선한다.
127 if (MoveHitResult.bBlockingHit)
128 {
129 FinishDash();
130 return;
131 }
132
133 // 4) 타겟 접촉 지점까지 도달했으면 히트 처리 후 정지한다.
134 if (bWillHitTarget)
135 {
136 BroadcastTargetHit(DashHitResult);
137 return;
138 }
139
141 {
142 FinishDash();
143 }
144}
bool SweepDashHit(const FVector &StartLocation, const FVector &EndLocation, FHitResult &OutHitResult) const
Definition AT_EnemyDashMove.cpp:169
void BroadcastTargetHit(const FHitResult &HitResult)
Definition AT_EnemyDashMove.cpp:222
float MovedDistance
Definition AT_EnemyDashMove.h:64
이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:

멤버 데이터 문서화

◆ bDashEnded

bool UAT_EnemyDashMove::bDashEnded = false
protected

◆ CachedPawnCollisionResponse

ECollisionResponse UAT_EnemyDashMove::CachedPawnCollisionResponse = ECR_Block
protected

◆ CapsuleComponent

TObjectPtr<UCapsuleComponent> UAT_EnemyDashMove::CapsuleComponent
protected

◆ DashDirection

FVector UAT_EnemyDashMove::DashDirection = FVector::ZeroVector
protected

◆ DashHitBoxComponent

TObjectPtr<UBoxComponent> UAT_EnemyDashMove::DashHitBoxComponent
protected

◆ DashSpeed

float UAT_EnemyDashMove::DashSpeed = 0.0f
protected

◆ HitTraceChannel

ECollisionChannel UAT_EnemyDashMove::HitTraceChannel = ECC_Pawn
protected

◆ MaxDistance

float UAT_EnemyDashMove::MaxDistance = 0.0f
protected

◆ MovedDistance

float UAT_EnemyDashMove::MovedDistance = 0.0f
protected

◆ MovementComponent

TObjectPtr<UCharacterMovementComponent> UAT_EnemyDashMove::MovementComponent
protected

◆ OnFinished

FEnemyDashMoveSignature UAT_EnemyDashMove::OnFinished

◆ OnTargetHit

FEnemyDashMoveHitSignature UAT_EnemyDashMove::OnTargetHit

◆ OwnerCharacter

TObjectPtr<ACharacter> UAT_EnemyDashMove::OwnerCharacter
protected

◆ RotationComponent

TObjectPtr<UCharacterMovementComponentBase> UAT_EnemyDashMove::RotationComponent
protected

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