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)
{
this->GetFirstPersonCameraComponent()->SetFieldOfView(90);
bIsPlayerMoving = false;
}
if (bPressedJump)
@ -96,15 +97,18 @@ void AEndlessVendettaCharacter::Tick(float DeltaTime)
}
}
//PLAYER STAMINA HANDLING
if (bIsPlayerSprinting)
if (MoveGroundSpeed > 0)
{
CurrentStamina -= FMath::Clamp(StaminaDecreaseRate, 0.0f, 100.0f);
if (CurrentStamina <= 0.0f)
if (bIsPlayerSprinting)
{
bIsPlayerSprinting = false;
this->GetFirstPersonCameraComponent()->SetFieldOfView(90);
CurrentStamina = 0.0f;
CharacterMovement->MaxWalkSpeed = OriginalWalkSpeed;
CurrentStamina -= FMath::Clamp(StaminaDecreaseRate, 0.0f, 100.0f);
if (CurrentStamina <= 0.0f)
{
bIsPlayerSprinting = false;
this->GetFirstPersonCameraComponent()->SetFieldOfView(90);
CurrentStamina = 0.0f;
CharacterMovement->MaxWalkSpeed = OriginalWalkSpeed;
}
}
}
if (!bIsPlayerSprinting)
@ -547,8 +551,11 @@ void AEndlessVendettaCharacter::Sprint()
bIsPlayerSprinting = true;
if (bIsPlayerSprinting)
{
CharacterMovement->MaxWalkSpeed = SprintSpeed;
this->GetFirstPersonCameraComponent()->SetFieldOfView(100);
if (MoveGroundSpeed > 0)
{
CharacterMovement->MaxWalkSpeed = SprintSpeed;
this->GetFirstPersonCameraComponent()->SetFieldOfView(100);
}
}
}
@ -565,7 +572,7 @@ void AEndlessVendettaCharacter::StopSprint()
void AEndlessVendettaCharacter::Jumping()
{
if (CurrentStamina > 20.0f)
if (CurrentStamina > 10.0f)
{
bHasPlayerJumped = true;
if (bHasPlayerJumped)
@ -573,7 +580,7 @@ void AEndlessVendettaCharacter::Jumping()
Super::Jump();
if (!CharacterMovement->IsFalling())
{
CurrentStamina -= 20.0f;
CurrentStamina -= 10.0f;
}
bHasPlayerJumped = false;
}