평타 알고리즘 22

This commit is contained in:
SJW1024
2023-10-15 01:23:33 +09:00
parent d3025bfbfa
commit a201059fbb
4 changed files with 36 additions and 35 deletions

Binary file not shown.

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

Binary file not shown.

View File

@@ -384,33 +384,7 @@ void ADefaultPlayerController::Move()
if (HitObject != nullptr) if (HitObject != nullptr)
{ {
float MinDistance = 100000.0f; // <20>ּ<EFBFBD> <20>Ÿ<EFBFBD> Attack(HitObject);
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);
SimpleMoveToLocation(this, Destination);
this->MoveToLocation(Destination);
}
} }
else else
{ {
@@ -590,11 +564,36 @@ void ADefaultPlayerController::OnMoveCompleted(FAIRequestID RequestID, const FPa
GetPlayerState<ADefaultPlayerState>()->SetState(ECharacterState::Idle); GetPlayerState<ADefaultPlayerState>()->SetState(ECharacterState::Idle);
} }
void ADefaultPlayerController::Attack() void ADefaultPlayerController::Attack(ACharacter* HitObject)
{ {
UE_LOG(LogTemp, Warning, TEXT("Attack")); //<2F>ݺ<EFBFBD><DDBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϱ<EFBFBD>
GetPlayerState<ADefaultPlayerState>()->SetState(ECharacterState::Attack); float MinDistance = 1000.0f; // <20>ּ<EFBFBD> <20>Ÿ<EFBFBD>(<28>ӽ<EFBFBD> : <20><><EFBFBD>Ŀ<EFBFBD> ij<><C4B3><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ÿ<EFBFBD> <20>޾ƿð<C6BF>)
GetPlayerState<ADefaultPlayerState>()->SetAttackType(CooldownType::Attack);
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());
UE_LOG(LogTemp, Warning, TEXT("Attack"));
GetPlayerState<ADefaultPlayerState>()->SetState(ECharacterState::Attack);
GetPlayerState<ADefaultPlayerState>()->SetAttackType(CooldownType::Attack);
}
else
{
GetPlayerState<ADefaultPlayerState>()->SetState(ECharacterState::Moving);
SimpleMoveToLocation(this, Destination);
this->MoveToLocation(Destination);
}
} }
void ADefaultPlayerController::MoveToLocation_Implementation(FVector Location) void ADefaultPlayerController::MoveToLocation_Implementation(FVector Location)

View File

@@ -64,7 +64,9 @@ public:
void OnMoveCompleted(FAIRequestID RequestID, const FPathFollowingResult &MovementResult); void OnMoveCompleted(FAIRequestID RequestID, const FPathFollowingResult &MovementResult);
void Attack();
void Attack(ACharacter* HitObject);
UPROPERTY(BlueprintReadWrite) UPROPERTY(BlueprintReadWrite)
float MouseClickInterval; float MouseClickInterval;