Add interaction input handling
This commit is contained in:
parent
72a0daf486
commit
5772da3965
5 changed files with 116 additions and 2 deletions
|
@ -1,3 +1,4 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
@ -5,13 +6,25 @@ using UnityEngine;
|
|||
public class GameInput : MonoBehaviour
|
||||
{
|
||||
|
||||
public event EventHandler OnInteractAction;
|
||||
|
||||
|
||||
private PlayerInputActions playerInputActions;
|
||||
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
playerInputActions = new PlayerInputActions();
|
||||
playerInputActions.Player.Enable();
|
||||
|
||||
playerInputActions.Player.Interact.performed += Interact_performed;
|
||||
}
|
||||
|
||||
private void Interact_performed(UnityEngine.InputSystem.InputAction.CallbackContext obj)
|
||||
{
|
||||
OnInteractAction?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
public Vector2 GetMovementVectorNormalized()
|
||||
{
|
||||
Vector2 inputVector = playerInputActions.Player.Move.ReadValue<Vector2>();
|
||||
|
|
Reference in a new issue