48 lines
1.3 KiB
C#
48 lines
1.3 KiB
C#
using UnityEngine;
|
|
using UnityEngine.InputSystem;
|
|
|
|
namespace AsteroidGame.Handlers
|
|
{
|
|
public class HandlerBase : MonoBehaviour
|
|
{
|
|
|
|
private HandlerControls _handlerControls;
|
|
|
|
private void Awake()
|
|
{
|
|
_handlerControls = new HandlerControls();
|
|
}
|
|
|
|
protected virtual void OnEnable()
|
|
{
|
|
_handlerControls.Player.Enable();
|
|
_handlerControls.Player.LeftClick.performed += OnLeftClick;
|
|
_handlerControls.Player.RightClick.performed += OnRightClick;
|
|
_handlerControls.Player.Build.performed += OnBuild;
|
|
}
|
|
|
|
protected virtual void OnDisable()
|
|
{
|
|
_handlerControls.Player.LeftClick.performed -= OnLeftClick;
|
|
_handlerControls.Player.RightClick.performed -= OnRightClick;
|
|
_handlerControls.Player.Build.performed -= OnBuild;
|
|
_handlerControls.Player.Disable();
|
|
}
|
|
|
|
protected virtual void OnLeftClick(InputAction.CallbackContext context)
|
|
{
|
|
|
|
}
|
|
|
|
protected virtual void OnRightClick(InputAction.CallbackContext context)
|
|
{
|
|
|
|
}
|
|
|
|
protected virtual void OnBuild(InputAction.CallbackContext context)
|
|
{
|
|
|
|
}
|
|
}
|
|
}
|