LethalCompany/Lethal Company/ExportedProject/Assets/Scripts/Assembly-CSharp/DisableMouseInMenu.cs
2023-12-22 18:30:10 -05:00

36 lines
818 B
C#

using UnityEngine;
using UnityEngine.InputSystem;
public class DisableMouseInMenu : MonoBehaviour
{
public PlayerActions actions;
private void Awake()
{
actions = new PlayerActions();
}
private void OnEnable()
{
actions.Movement.Move.performed += Move_performed;
actions.Movement.Look.performed += Look_performed;
actions.Enable();
}
private void OnDisable()
{
actions.Movement.Move.performed -= Move_performed;
actions.Movement.Look.performed -= Look_performed;
actions.Disable();
}
private void Look_performed(InputAction.CallbackContext context)
{
Cursor.visible = InputControlPath.MatchesPrefix("<Mouse>", context.control);
}
private void Move_performed(InputAction.CallbackContext context)
{
Cursor.visible = InputControlPath.MatchesPrefix("<Mouse>", context.control);
}
}