mirror of
https://github.com/DerTyp7/fps-citybuild-unity.git
synced 2025-10-30 12:37:08 +01:00
Update PlayerMovement.cs
This commit is contained in:
@@ -24,6 +24,7 @@ public class PlayerMovement : MonoBehaviour
|
|||||||
private Rigidbody rb;
|
private Rigidbody rb;
|
||||||
private bool isGrounded;
|
private bool isGrounded;
|
||||||
private float modifiedSpeed;
|
private float modifiedSpeed;
|
||||||
|
private bool isJumpSprinting = false;
|
||||||
float x;
|
float x;
|
||||||
float z;
|
float z;
|
||||||
|
|
||||||
@@ -51,6 +52,12 @@ public class PlayerMovement : MonoBehaviour
|
|||||||
{
|
{
|
||||||
//Check every frame if the player stands on the ground
|
//Check every frame if the player stands on the ground
|
||||||
isGrounded = Physics.CheckSphere(groundCheck.position, groundDistance, groundMask);
|
isGrounded = Physics.CheckSphere(groundCheck.position, groundDistance, groundMask);
|
||||||
|
|
||||||
|
if (isGrounded)
|
||||||
|
{
|
||||||
|
isJumpSprinting = false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
private void MovementSpeed()
|
private void MovementSpeed()
|
||||||
{
|
{
|
||||||
@@ -78,14 +85,6 @@ public class PlayerMovement : MonoBehaviour
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Sprint jump
|
|
||||||
if (isSprinting && Input.GetButtonDown("Jump"))
|
|
||||||
{
|
|
||||||
Debug.Log("Jump Sprint");
|
|
||||||
rb.AddRelativeForce(Vector3.forward * jumpSprintSpeedModifier);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
x = Input.GetAxis("Horizontal");
|
x = Input.GetAxis("Horizontal");
|
||||||
z = Input.GetAxis("Vertical");
|
z = Input.GetAxis("Vertical");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user