first commit
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class PlayerInput : MonoBehaviour
|
||||
{
|
||||
public Vector3 MoveInput { get; private set; }
|
||||
public bool JumpPressed { get; private set; }
|
||||
|
||||
private void Update()
|
||||
{
|
||||
float horizontal = Input.GetAxisRaw("Horizontal");
|
||||
float vertical = Input.GetAxisRaw("Vertical");
|
||||
|
||||
MoveInput = new Vector3(horizontal, 0f, vertical).normalized;
|
||||
|
||||
if (Input.GetButtonDown("Jump"))
|
||||
{
|
||||
JumpPressed = true;
|
||||
}
|
||||
}
|
||||
|
||||
public bool ConsumeJump()
|
||||
{
|
||||
if (!JumpPressed)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
JumpPressed = false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user