Move to new input system
This commit is contained in:
parent
27fd68c1c2
commit
4a2f04bc03
5 changed files with 323 additions and 18 deletions
|
@ -4,26 +4,17 @@ using UnityEngine;
|
|||
|
||||
public class GameInput : MonoBehaviour
|
||||
{
|
||||
|
||||
private PlayerInputActions playerInputActions;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
playerInputActions = new PlayerInputActions();
|
||||
playerInputActions.Player.Enable();
|
||||
}
|
||||
public Vector2 GetMovementVectorNormalized()
|
||||
{
|
||||
Vector2 inputVector = new Vector2(0, 0);
|
||||
|
||||
if (Input.GetKey(KeyCode.W))
|
||||
{
|
||||
inputVector.y = +1;
|
||||
}
|
||||
if (Input.GetKey(KeyCode.S))
|
||||
{
|
||||
inputVector.y = -1;
|
||||
}
|
||||
if (Input.GetKey(KeyCode.A))
|
||||
{
|
||||
inputVector.x = -1;
|
||||
}
|
||||
if (Input.GetKey(KeyCode.D))
|
||||
{
|
||||
inputVector.x = +1;
|
||||
}
|
||||
Vector2 inputVector = playerInputActions.Player.Move.ReadValue<Vector2>();
|
||||
|
||||
inputVector = inputVector.normalized;
|
||||
|
||||
|
|
Reference in a new issue