1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- using System;
- using UnityEngine;
- using Rokid.UXR.Utility;
- namespace Rokid.UXR.Interaction
- {
- /// <summary>
- /// Hand Selector
- /// </summary>
- public class HandHeadSelector : MonoBehaviour, ISelector, IHeadHandDriver
- {
- private bool press = false;
- public event Action WhenSelected;
- public event Action WhenUnselected;
- public void OnHandPress(HandType hand)
- {
- if (press == false)
- {
- press = true;
- WhenSelected?.Invoke();
- }
- }
- public void OnHandRelease()
- {
- if (press)
- {
- press = false;
- WhenUnselected?.Invoke();
- }
- }
- public void OnChangeHoldHandType(HandType hand)
- {
- }
- void Update()
- {
- if (Utils.IsUnityEditor())
- {
- if (Input.GetMouseButtonDown(0))
- {
- WhenSelected?.Invoke();
- }
- if (Input.GetMouseButtonUp(0))
- {
- WhenUnselected?.Invoke();
- }
- }
- }
- public void OnBeforeChangeHoldHandType(HandType hand)
- {
- }
- }
- }
|