Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using UnityEngine.Events;
- [System.Serializable]
- public class LaneHitEvent : UnityEvent<int> { }
- public class Detector : MonoBehaviour
- {
- public LaneHitEvent OnButtonPressed;
- private void Update()
- {
- if (Input.GetKeyDown(KeyCode.Alpha1))
- OnButtonPressed.Invoke(1);
- if (Input.GetKeyDown(KeyCode.Alpha2))
- OnButtonPressed.Invoke(2);
- if (Input.GetKeyDown(KeyCode.Alpha3))
- OnButtonPressed.Invoke(3);
- if (Input.GetKeyDown(KeyCode.Alpha4))
- OnButtonPressed.Invoke(4);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment