simple UI added
This commit is contained in:
@@ -6,16 +6,23 @@ using UnityEngine.InputSystem;
|
||||
public class InputReader : ScriptableObject, IInputReader, GameInput.IPlayerActions
|
||||
{
|
||||
public Action<Vector2> OnDragValueChanged;
|
||||
|
||||
public Vector2 _dragInput;
|
||||
public Vector2 dragInput
|
||||
{
|
||||
get=> _dragInput;
|
||||
private set
|
||||
{
|
||||
|
||||
_dragInput = value;
|
||||
OnDragValueChanged?.Invoke(_dragInput);
|
||||
}
|
||||
}
|
||||
|
||||
public float clickInput { get; private set; }
|
||||
|
||||
public bool isclicked {get; private set; }
|
||||
|
||||
private GameInput inputActions;
|
||||
|
||||
private void OnEnable()
|
||||
@@ -25,10 +32,11 @@ public class InputReader : ScriptableObject, IInputReader, GameInput.IPlayerActi
|
||||
inputActions = new GameInput();
|
||||
inputActions.Player.SetCallbacks(this);
|
||||
}
|
||||
|
||||
inputActions.Enable();
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
public void OnDisable()
|
||||
{
|
||||
inputActions?.Player.Disable();
|
||||
}
|
||||
@@ -37,4 +45,11 @@ public class InputReader : ScriptableObject, IInputReader, GameInput.IPlayerActi
|
||||
{
|
||||
dragInput = context.ReadValue<Vector2>();
|
||||
}
|
||||
|
||||
public void OnClick(InputAction.CallbackContext context)
|
||||
{
|
||||
clickInput = context.ReadValue<float>();
|
||||
isclicked = clickInput == 1? true : false;
|
||||
Debug.Log(isclicked);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user