mirror of
https://github.com/DerTyp7/defrain-shooter-unity.git
synced 2025-10-29 20:52:10 +01:00
mb fixed CharacterController; FpsCount
This commit is contained in:
@@ -7,9 +7,15 @@ public class DebugCanvas : MonoBehaviour
|
||||
{
|
||||
public TextMeshProUGUI DebugTextGrounded;
|
||||
public GameObject Player;
|
||||
public TextMeshProUGUI fpsText;
|
||||
public float deltaTime;
|
||||
|
||||
private void Update()
|
||||
{
|
||||
DebugTextGrounded.text = "isGrounded: " + Player.GetComponent<PlayerController>().isGrounded.ToString();
|
||||
|
||||
deltaTime += (Time.deltaTime - deltaTime) * 0.1f;
|
||||
float fps = 1.0f / deltaTime;
|
||||
fpsText.text = Mathf.Ceil(fps).ToString() + "FPS";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,6 +72,10 @@ public class PlayerController : MonoBehaviour
|
||||
}
|
||||
private void UpdateMovement()
|
||||
{
|
||||
//Grounded
|
||||
velocityY += gravity * Time.deltaTime;
|
||||
if (isGrounded && velocityY < 0)
|
||||
velocityY = 0.0f;
|
||||
|
||||
//Jump
|
||||
if (Input.GetButtonDown("Jump") && isGrounded)
|
||||
@@ -80,14 +84,6 @@ public class PlayerController : MonoBehaviour
|
||||
velocityY += Mathf.Sqrt(jumpHeight * -2f * gravity);
|
||||
}
|
||||
|
||||
//Grounded
|
||||
|
||||
if (isGrounded)
|
||||
velocityY = 0.0f;
|
||||
|
||||
velocityY += gravity * Time.deltaTime;
|
||||
|
||||
|
||||
Vector2 targetDir = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical")); //Get Inputs
|
||||
targetDir.Normalize(); //Damit schr<68>g laufen nicht schneller ist
|
||||
|
||||
|
||||
Reference in New Issue
Block a user