mirror of
https://github.com/ConjureETS/GameOff2024.git
synced 2026-03-24 05:00:59 +00:00
40 lines
842 B
C#
40 lines
842 B
C#
using System;
|
|
using UnityEngine;
|
|
|
|
namespace GameOff.Player
|
|
{
|
|
[DefaultExecutionOrder(-100)]
|
|
|
|
public class PlayerInputHandler: MonoBehaviour
|
|
{
|
|
public event EventHandler OnChangeState;
|
|
public Vector2 Mouse { get; private set; }
|
|
|
|
private GameInputs _input;
|
|
|
|
private void Awake()
|
|
{
|
|
_input = new GameInputs();
|
|
}
|
|
|
|
private void OnEnable()
|
|
{
|
|
_input.Player.Enable();
|
|
}
|
|
|
|
private void OnDisable()
|
|
{
|
|
_input.Player.Disable();
|
|
}
|
|
|
|
private void Start()
|
|
{
|
|
_input.Player.ChangeState.performed += _ => OnChangeState?.Invoke(this, EventArgs.Empty);
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
Mouse = _input.Player.Mouse.ReadValue<Vector2>();
|
|
}
|
|
}
|
|
} |