Added FOV Fixes to sprint bar

This commit is contained in:
MH261677 2023-11-30 15:38:16 +00:00
parent c9acf07ccd
commit b3b2dac792

View File

@ -86,6 +86,7 @@ void AEndlessVendettaCharacter::Tick(float DeltaTime)
} }
else if (MoveGroundSpeed <= 0) else if (MoveGroundSpeed <= 0)
{ {
this->GetFirstPersonCameraComponent()->SetFieldOfView(90);
bIsPlayerMoving = false; bIsPlayerMoving = false;
} }
if (bPressedJump) if (bPressedJump)
@ -96,6 +97,8 @@ void AEndlessVendettaCharacter::Tick(float DeltaTime)
} }
} }
//PLAYER STAMINA HANDLING //PLAYER STAMINA HANDLING
if (MoveGroundSpeed > 0)
{
if (bIsPlayerSprinting) if (bIsPlayerSprinting)
{ {
CurrentStamina -= FMath::Clamp(StaminaDecreaseRate, 0.0f, 100.0f); CurrentStamina -= FMath::Clamp(StaminaDecreaseRate, 0.0f, 100.0f);
@ -107,6 +110,7 @@ void AEndlessVendettaCharacter::Tick(float DeltaTime)
CharacterMovement->MaxWalkSpeed = OriginalWalkSpeed; CharacterMovement->MaxWalkSpeed = OriginalWalkSpeed;
} }
} }
}
if (!bIsPlayerSprinting) if (!bIsPlayerSprinting)
{ {
if(CurrentStamina >= 100.0f) if(CurrentStamina >= 100.0f)
@ -546,10 +550,13 @@ void AEndlessVendettaCharacter::Sprint()
{ {
bIsPlayerSprinting = true; bIsPlayerSprinting = true;
if (bIsPlayerSprinting) if (bIsPlayerSprinting)
{
if (MoveGroundSpeed > 0)
{ {
CharacterMovement->MaxWalkSpeed = SprintSpeed; CharacterMovement->MaxWalkSpeed = SprintSpeed;
this->GetFirstPersonCameraComponent()->SetFieldOfView(100); this->GetFirstPersonCameraComponent()->SetFieldOfView(100);
} }
}
} }
void AEndlessVendettaCharacter::StopSprint() void AEndlessVendettaCharacter::StopSprint()
@ -565,7 +572,7 @@ void AEndlessVendettaCharacter::StopSprint()
void AEndlessVendettaCharacter::Jumping() void AEndlessVendettaCharacter::Jumping()
{ {
if (CurrentStamina > 20.0f) if (CurrentStamina > 10.0f)
{ {
bHasPlayerJumped = true; bHasPlayerJumped = true;
if (bHasPlayerJumped) if (bHasPlayerJumped)
@ -573,7 +580,7 @@ void AEndlessVendettaCharacter::Jumping()
Super::Jump(); Super::Jump();
if (!CharacterMovement->IsFalling()) if (!CharacterMovement->IsFalling())
{ {
CurrentStamina -= 20.0f; CurrentStamina -= 10.0f;
} }
bHasPlayerJumped = false; bHasPlayerJumped = false;
} }