LeapProvider.cs 761 B

12345678910111213141516171819202122232425262728293031323334353637
  1. using System;
  2. using System.Diagnostics;
  3. using UnityEngine;
  4. namespace Leap.Unity
  5. {
  6. public abstract class LeapProvider : MonoBehaviour
  7. {
  8. [DebuggerBrowsable(DebuggerBrowsableState.Never)]
  9. public event Action<Frame> OnUpdateFrame;
  10. [DebuggerBrowsable(DebuggerBrowsableState.Never)]
  11. public event Action<Frame> OnFixedFrame;
  12. public abstract Frame CurrentFrame { get; }
  13. public abstract Frame CurrentFixedFrame { get; }
  14. public abstract Image CurrentImage { get; }
  15. protected void DispatchUpdateFrameEvent(Frame frame)
  16. {
  17. if (this.OnUpdateFrame != null)
  18. {
  19. this.OnUpdateFrame(frame);
  20. }
  21. }
  22. protected void DispatchFixedFrameEvent(Frame frame)
  23. {
  24. if (this.OnFixedFrame != null)
  25. {
  26. this.OnFixedFrame(frame);
  27. }
  28. }
  29. }
  30. }