| | | 1 | | using System.Collections; |
| | | 2 | | using System.Collections.Generic; |
| | | 3 | | using UnityEngine; |
| | | 4 | | using UnityEngine.InputSystem; |
| | | 5 | | using UnityEngine.Events; |
| | | 6 | | |
| | | 7 | | public class gripActivate : MonoBehaviour |
| | | 8 | | { |
| | | 9 | | |
| | | 10 | | public InputActionReference gripReference; |
| | | 11 | | |
| | | 12 | | [Space] |
| | | 13 | | public UnityEvent onGripActivate; |
| | | 14 | | public UnityEvent onGripCancel; |
| | | 15 | | |
| | | 16 | | // Start is called before the first frame update |
| | | 17 | | void Start() |
| | 8 | 18 | | { |
| | 8 | 19 | | gripReference.action.performed += gripPerformed; |
| | 8 | 20 | | gripReference.action.canceled += gripCancel; |
| | 8 | 21 | | } |
| | | 22 | | |
| | 0 | 23 | | private void gripCancel(InputAction.CallbackContext obj) => onGripCancel.Invoke(); |
| | | 24 | | |
| | 0 | 25 | | private void gripPerformed(InputAction.CallbackContext obj) => onGripActivate.Invoke(); |
| | | 26 | | |
| | | 27 | | } |