* 해결
아래와같이 리뉴얼함
- 이전코드
// // CursorHit에서 반환된 충돌된 액터를 IEnemyInterface로 캐스팅하여 ThisActor에 할당합니다.
// // IEnemyInterface를 구현한 액터에 대해서만 작동합니다.
// //아닌 액터이면 nullptr
// //* interface는 =안됨, setter써야함! *
// AActor* HitActor = CursorHit.GetActor();
// if (HitActor && HitActor->Implements<UEnemyInterface>())
// {
// ThisActor.SetObject(HitActor);
// ThisActor.SetInterface(Cast<IEnemyInterface>(HitActor));
// }
//
// /**
// * Line trace from cursor. There are several scenarios:
// * A. LastActor is null && ThisActor is null
// * - Do nothing
// * B. LastActor is null && ThisActor is valid
// * - Highlight ThisActor
// * C. LastActor is valid && ThisActor is null
// * - UnHighlight LastActor
// * D. Both actors are valid, but LastActor != ThisActor
// * - UnHighlight LastActor, and Highlight ThisActor
// * E. Both actors are valid, and are the same actor
// * - Do nothing
// */
//
// if (LastActor == nullptr)
// {
// if (ThisActor != nullptr)
// {
// // Case B
// ThisActor->HighlightActor();
// }
// else
// {
// // Case A - both are null, do nothing
// }
// }
// else // LastActor is valid
// {
// if (ThisActor == nullptr)
// {
// // Case C
// LastActor->UnHighlightActor();
// }
// else // both actors are valid
// {
// if (LastActor != ThisActor)
// {
// // Case D
// LastActor->UnHighlightActor();
// ThisActor->HighlightActor();
// }
// else
// {
// // Case E - do nothing
// }
// }
// }
- 뉴 코드
void AAuraPlayerController::CursorTrace()
{
// 레이캐스트를 통해 마우스 커서 아래에 있는 객체에 대한 충돌 결과를 가져옵니다.
// ECC_Visibility 콜리전 채널을 사용하여 가시성이 있는 오브젝트를 대상으로 합니다.
// 두 번째 매개변수는 복합 콜리전에 대한 단일 충돌만 반환해야 하는지 여부를 나타냅니다.
// CursorHit 변수에 결과가 저장됩니다.
GetHitResultUnderCursor(ECC_Visibility, false, CursorHit);
// 마우스 커서 아래에 아무것도 막히지 않았다면 함수를 종료합니다.
if (!CursorHit.bBlockingHit) return;
// LastActor를 현재 ThisActor로 설정합니다.
// 새로계산 전에 저장목적
LastActor = ThisActor;
ThisActor = Cast<IEnemyInterface>(CursorHit.GetActor());
if(LastActor!=ThisActor)
{
if (LastActor) LastActor->UnHighlightActor(); //이전적을 해제
if (ThisActor) ThisActor->HighlightActor(); //이번적을 하일라이트
}
* 고블린눌러도 불 안나가는 버그수정
이건 버그가아님, 능력이 1회만 부여되서 그런듯?
아니면 발사체가 서버에 없어서?
-> 불 발사후, End Ability를 호출안해서 그럼
능력이 있으면 즉시 return 하게 구현했었음.
https://mini-96.tistory.com/490
뒷장에서 해결했음, 참조
'UE5 > Gameplay Abilities' 카테고리의 다른 글
[UE5] Gameplay Abilities 퀴즈 (0) | 2024.06.09 |
---|---|
[UE5] 파이어볼 생성 구현 (0) | 2024.06.09 |
[UE5] PC 리팩토링, 클라에서 포션먹음 메시지 안뜨는 버그수정, 클라이언트 RPC (0) | 2024.06.09 |
[UE5] Click To Move 구현 (0) | 2024.06.09 |
[UE5] 태그에 맞는 능력 활성화 구현 (0) | 2024.06.09 |