IHandModel.cs 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. using System;
  2. using System.Diagnostics;
  3. using UnityEngine;
  4. namespace Leap.Unity
  5. {
  6. [ExecuteInEditMode]
  7. public abstract class IHandModel : MonoBehaviour
  8. {
  9. [DebuggerBrowsable(DebuggerBrowsableState.Never)]
  10. public event Action OnBegin;
  11. [DebuggerBrowsable(DebuggerBrowsableState.Never)]
  12. public event Action OnFinish;
  13. public bool IsTracked
  14. {
  15. get
  16. {
  17. return this.isTracked;
  18. }
  19. }
  20. public abstract Chirality Handedness { get; set; }
  21. public abstract ModelType HandModelType { get; }
  22. public virtual void InitHand()
  23. {
  24. }
  25. public virtual void BeginHand()
  26. {
  27. if (this.OnBegin != null)
  28. {
  29. this.OnBegin();
  30. }
  31. this.isTracked = true;
  32. }
  33. public abstract void UpdateHand();
  34. public virtual void FinishHand()
  35. {
  36. if (this.OnFinish != null)
  37. {
  38. this.OnFinish();
  39. }
  40. this.isTracked = false;
  41. }
  42. public abstract Hand GetLeapHand();
  43. public abstract void SetLeapHand(Hand hand);
  44. public virtual bool SupportsEditorPersistence()
  45. {
  46. return false;
  47. }
  48. private bool isTracked;
  49. }
  50. }