Files
beyond/Assets/Scripts/InputEventWrapper.cs
2024-11-20 15:21:28 +01:00

32 lines
746 B
C#

using Invector;
using Invector.vCharacterController;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
public class InputEventWrapper : MonoBehaviour
{
[vEditorToolbar("Input Mapping")]
public GenericInput input = new GenericInput("K", "K", "K");
public UnityEvent OnButtonPressed;
[SerializeField]
private float buttonInputDelay = 0.5f;
private float currentTime = 0f;
public void LateUpdate()
{
if (currentTime >= 0)
{
currentTime -= Time.deltaTime;
}
if (input.GetButtonDown() && currentTime < 0)
{
currentTime = buttonInputDelay;
OnButtonPressed?.Invoke();
}
}
}