1234567891011121314151617181920212223 |
- using System;
- using UnityEngine;
- namespace Rokid.UXR.Interaction {
- public class MouseSelector : MonoBehaviour, ISelector
- {
- public event Action WhenSelected;
- public event Action WhenUnselected;
-
- void Update()
- {
- if (Input.GetMouseButtonDown(0) || Input.GetKeyDown(KeyCode.JoystickButton0))
- {
- WhenSelected?.Invoke();
- }
-
- if (Input.GetMouseButtonUp(0) || Input.GetKeyUp(KeyCode.JoystickButton0))
- {
- WhenUnselected?.Invoke();
- }
- }
- }
- }
|