IHandModel.cs 916 B

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