기본 공격 알고리즘 설계중

This commit is contained in:
SJW1024
2023-10-15 00:35:56 +09:00
parent fe6d559697
commit d3025bfbfa
8 changed files with 63 additions and 15 deletions

Binary file not shown.

BIN
Content/Character/Lb/BP_Lb.uasset (Stored with Git LFS)

Binary file not shown.

Binary file not shown.

BIN
Content/InputActions/ObjectSelect.uasset (Stored with Git LFS)

Binary file not shown.

BIN
Content/Maps/DevMap.umap (Stored with Git LFS)

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -371,15 +371,63 @@ void ADefaultPlayerController::ObjectSelect()
SetACharacterOutlineColor(HitObject, true); SetACharacterOutlineColor(HitObject, true);
} }
void ADefaultPlayerController::Move() void ADefaultPlayerController::Move()
{ {
FVector Destination = GetMouseHitLocation(); FHitResult HitResult;
TArray<TEnumAsByte<EObjectTypeQuery>> ObjectTypes;
ObjectTypes.Add(UEngineTypes::ConvertToObjectType(ECollisionChannel::ECC_WorldStatic));
ObjectTypes.Add(UEngineTypes::ConvertToObjectType(ECollisionChannel::ECC_Pawn));
GetHitResultUnderCursorForObjects(ObjectTypes, true, HitResult);
ACharacter* HitObject = Cast<ACharacter>(HitResult.GetActor());
if (HitObject != nullptr)
{
float MinDistance = 100000.0f; // <20>ּ<EFBFBD> <20>Ÿ<EFBFBD>
FVector Destination = HitObject->GetActorLocation(); // HitObject<63><74> <20><>ġ<EFBFBD><C4A1> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
if (FVector::Dist(Destination, GetPawn()->GetActorLocation()) <= MinDistance)
{
FVector Location = GetPawn()->GetActorLocation();
Location.Z = 0;
Server_StopMove();
Multicast_StopMove();
Multicast_SetRotation(GetMouseHitLocation());
Server_SetRotation(GetMouseHitLocation());
GetPlayerState<ADefaultPlayerState>()->SetState(ECharacterState::Attack);
GetPlayerState<ADefaultPlayerState>()->SetAttackType(CooldownType::Attack);
}
else
{
GetPlayerState<ADefaultPlayerState>()->SetState(ECharacterState::Moving); GetPlayerState<ADefaultPlayerState>()->SetState(ECharacterState::Moving);
SimpleMoveToLocation(this, Destination); SimpleMoveToLocation(this, Destination);
this->MoveToLocation(Destination); this->MoveToLocation(Destination);
} }
}
else
{
HitObject = nullptr;
FVector Destination = GetMouseHitLocation();
GetPlayerState<ADefaultPlayerState>()->SetState(ECharacterState::Moving);
SimpleMoveToLocation(this, Destination);
this->MoveToLocation(Destination);
}
}
void ADefaultPlayerController::Multicast_SetRotation_Implementation(FVector MouseHitLocation) void ADefaultPlayerController::Multicast_SetRotation_Implementation(FVector MouseHitLocation)
{ {
FVector Location = GetPawn()->GetActorLocation(); FVector Location = GetPawn()->GetActorLocation();