32 lines
650 B
C#
32 lines
650 B
C#
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;
|
|
}
|
|
}
|