LeapProvider.cs 631 B

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