Update PlayerMovement.cs

This commit is contained in:
DerTyp187
2021-09-29 20:12:28 +02:00
parent d211c0468e
commit 97d5ba183b

View File

@@ -24,6 +24,7 @@ public class PlayerMovement : MonoBehaviour
private Rigidbody rb;
private bool isGrounded;
private float modifiedSpeed;
private bool isJumpSprinting = false;
float x;
float z;
@@ -51,6 +52,12 @@ public class PlayerMovement : MonoBehaviour
{
//Check every frame if the player stands on the ground
isGrounded = Physics.CheckSphere(groundCheck.position, groundDistance, groundMask);
if (isGrounded)
{
isJumpSprinting = false;
}
}
private void MovementSpeed()
{
@@ -76,15 +83,7 @@ public class PlayerMovement : MonoBehaviour
{
isSneaking = false;
}
}
//Sprint jump
if (isSprinting && Input.GetButtonDown("Jump"))
{
Debug.Log("Jump Sprint");
rb.AddRelativeForce(Vector3.forward * jumpSprintSpeedModifier);
}
}
x = Input.GetAxis("Horizontal");
z = Input.GetAxis("Vertical");