27 lines
615 B
C#
27 lines
615 B
C#
using UnityEngine;
|
|
using UnityEngine.InputSystem;
|
|
using static GameInputs;
|
|
|
|
public class InputReader : ScriptableObject, IInputReader, IPlayerActions
|
|
{
|
|
private GameInputs _inputActions;
|
|
|
|
public Vector2 DragInput { get; private set;}
|
|
|
|
void OnEnable()
|
|
{
|
|
if (_inputActions == null)
|
|
{
|
|
_inputActions = new GameInputs();
|
|
_inputActions.Player.SetCallbacks(this);
|
|
}
|
|
_inputActions.Enable();
|
|
}
|
|
public void OnDrag(InputAction.CallbackContext context)
|
|
{
|
|
DragInput = context.ReadValue<Vector2>();
|
|
Debug.Log(DragInput);
|
|
}
|
|
|
|
}
|