평타 알고리즘 22
This commit is contained in:
BIN
Content/Character/Lb/Animation/ABP_Lb.uasset
(Stored with Git LFS)
BIN
Content/Character/Lb/Animation/ABP_Lb.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Maps/DevMap.umap
(Stored with Git LFS)
BIN
Content/Maps/DevMap.umap
(Stored with Git LFS)
Binary file not shown.
@@ -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)
|
||||||
{
|
{
|
||||||
|
//<2F>ݺ<EFBFBD><DDBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϱ<EFBFBD>
|
||||||
|
float MinDistance = 1000.0f; // <20>ּ<EFBFBD> <20>Ÿ<EFBFBD>(<28>ӽ<EFBFBD> : <20><><EFBFBD>Ŀ<EFBFBD> ij<><C4B3><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ÿ<EFBFBD> <20>ƿð<C6BF>)
|
||||||
|
|
||||||
|
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"));
|
UE_LOG(LogTemp, Warning, TEXT("Attack"));
|
||||||
GetPlayerState<ADefaultPlayerState>()->SetState(ECharacterState::Attack);
|
GetPlayerState<ADefaultPlayerState>()->SetState(ECharacterState::Attack);
|
||||||
GetPlayerState<ADefaultPlayerState>()->SetAttackType(CooldownType::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)
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user