您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
37 行
894 B
37 行
894 B
using UnityEngine;
|
|
#if ENABLE_INPUT_SYSTEM
|
|
using UnityEngine.InputSystem;
|
|
#endif
|
|
|
|
namespace GameplayIngredients.Events
|
|
{
|
|
#if !ENABLE_INPUT_SYSTEM
|
|
[WarnDisabledModule("New Input System")]
|
|
#endif
|
|
[AddComponentMenu(ComponentMenu.eventsPath + "On Input Action Event (New Input System)")]
|
|
public class OnInputActionEvent : EventBase
|
|
{
|
|
#if ENABLE_INPUT_SYSTEM
|
|
[SerializeField]
|
|
InputAction inputAction;
|
|
|
|
public Callable[] onButtonDown;
|
|
|
|
private void OnEnable()
|
|
{
|
|
InputActionManager.Request(inputAction, InputAction_performed);
|
|
}
|
|
private void OnDisable()
|
|
{
|
|
InputActionManager.Release(inputAction, InputAction_performed);
|
|
}
|
|
|
|
private void InputAction_performed(InputAction.CallbackContext obj)
|
|
{
|
|
Callable.Call(onButtonDown, gameObject);
|
|
}
|
|
#endif
|
|
}
|
|
}
|
|
|
|
|