diff --git a/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.cpp b/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.cpp index 1fb28751..438d89e8 100644 --- a/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.cpp +++ b/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.cpp @@ -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; }