NRHand.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /****************************************************************************
  2. * Copyright 2019 Nreal Techonology Limited. All rights reserved.
  3. *
  4. * This file is part of NRSDK.
  5. *
  6. * https://www.nreal.ai/
  7. *
  8. *****************************************************************************/
  9. namespace NRKernal
  10. {
  11. using System;
  12. using System.Collections.Generic;
  13. using UnityEngine;
  14. /// <summary> NRHand usually used as a root of left/right hand. </summary>
  15. public class NRHand : MonoBehaviour
  16. {
  17. [SerializeField]
  18. private HandEnum m_HandEnum = HandEnum.None;
  19. public HandEnum HandEnum { get { return m_HandEnum; } }
  20. private void Awake()
  21. {
  22. if(m_HandEnum == HandEnum.None)
  23. {
  24. Debug.LogError("HandEnum Should Not Be None !");
  25. return;
  26. }
  27. NRInput.Hands.RegistHand(this);
  28. }
  29. private void OnDestroy()
  30. {
  31. NRInput.Hands.UnRegistHand(this);
  32. }
  33. public HandState GetHandState()
  34. {
  35. return NRInput.Hands.GetHandState(m_HandEnum);
  36. }
  37. }
  38. }