29 lines
919 B
C#
29 lines
919 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.InputSystem;
|
|
using System;
|
|
namespace BITKit
|
|
{
|
|
public static partial class InputSystemExtensions
|
|
{
|
|
public static bool JustPressed(this InputAction.CallbackContext self)
|
|
{
|
|
return self.interaction is null && self.started;
|
|
}
|
|
public static InputAction RegisterCallback(this InputAction self, Action<InputAction.CallbackContext> action)
|
|
{
|
|
self.performed += action;
|
|
self.started += action;
|
|
self.canceled += action;
|
|
return self;
|
|
}
|
|
public static InputAction UnRegisterCallback(this InputAction self, Action<InputAction.CallbackContext> action)
|
|
{
|
|
self.performed -= action;
|
|
self.started -= action;
|
|
self.canceled -= action;
|
|
return self;
|
|
}
|
|
}
|
|
} |