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,15 +97,18 @@ void AEndlessVendettaCharacter::Tick(float DeltaTime)
} }
} }
//PLAYER STAMINA HANDLING //PLAYER STAMINA HANDLING
if (bIsPlayerSprinting) if (MoveGroundSpeed > 0)
{ {
CurrentStamina -= FMath::Clamp(StaminaDecreaseRate, 0.0f, 100.0f); if (bIsPlayerSprinting)
if (CurrentStamina <= 0.0f)
{ {
bIsPlayerSprinting = false; CurrentStamina -= FMath::Clamp(StaminaDecreaseRate, 0.0f, 100.0f);
this->GetFirstPersonCameraComponent()->SetFieldOfView(90); if (CurrentStamina <= 0.0f)
CurrentStamina = 0.0f; {
CharacterMovement->MaxWalkSpeed = OriginalWalkSpeed; bIsPlayerSprinting = false;
this->GetFirstPersonCameraComponent()->SetFieldOfView(90);
CurrentStamina = 0.0f;
CharacterMovement->MaxWalkSpeed = OriginalWalkSpeed;
}
} }
} }
if (!bIsPlayerSprinting) if (!bIsPlayerSprinting)
@ -547,8 +551,11 @@ void AEndlessVendettaCharacter::Sprint()
bIsPlayerSprinting = true; bIsPlayerSprinting = true;
if (bIsPlayerSprinting) if (bIsPlayerSprinting)
{ {
CharacterMovement->MaxWalkSpeed = SprintSpeed; if (MoveGroundSpeed > 0)
this->GetFirstPersonCameraComponent()->SetFieldOfView(100); {
CharacterMovement->MaxWalkSpeed = SprintSpeed;
this->GetFirstPersonCameraComponent()->SetFieldOfView(100);
}
} }
} }
@ -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;
} }