Initial commit

This commit is contained in:
Mausham
2025-12-14 18:16:49 +05:45
commit 94e8eba3b1
236 changed files with 84425 additions and 0 deletions

View File

@@ -0,0 +1,49 @@
using System;
using UnityEngine;
using UnityEngine.InputSystem;
[CreateAssetMenu(fileName = "InputReaderSO", menuName = "Scriptable Objects/InputReaderSO")]
public class InputReaderSO : ScriptableObject, GameInputAction.IPlayerActions , IInputReader
{
public event Action<Vector2> OnDragValueChanged;
public Vector2 dragInput {
get => _dragInput;
private set {
_dragInput = value;
OnDragValueChanged?.Invoke(_dragInput);
}
}
public bool isMouseButtonPressed { get;private set; }
public bool blockedInput { get; set; }
private Vector2 _dragInput;
private GameInputAction action;
private void OnEnable()
{
if(action == null) action = new GameInputAction();
action.Enable();
action.Player.SetCallbacks(this);
blockedInput = false;
}
private void OnDisable()
{
action.Player.Disable();
}
public void OnDrag(InputAction.CallbackContext context)
{
if (blockedInput) return;
dragInput = context.ReadValue<Vector2>();
}
public void OnMouseClicked(InputAction.CallbackContext context)
{
if (blockedInput) return;
isMouseButtonPressed = context.ReadValue<float>() == 1 ? true : false;
}
}