ControllerProviderBase.cs 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. /// <summary> A controller provider base. </summary>
  12. public abstract class ControllerProviderBase
  13. {
  14. /// <summary> The states. </summary>
  15. protected ControllerState[] states;
  16. /// <summary> Gets or sets a value indicating whether the inited. </summary>
  17. /// <value> True if inited, false if not. </value>
  18. public bool Inited { get; protected set; }
  19. /// <summary> Constructor. </summary>
  20. /// <param name="states"> The states.</param>
  21. public ControllerProviderBase(ControllerState[] states)
  22. {
  23. this.states = states;
  24. }
  25. /// <summary> Gets the number of controllers. </summary>
  26. /// <value> The number of controllers. </value>
  27. public abstract int ControllerCount { get; }
  28. /// <summary> Executes the 'pause' action. </summary>
  29. public abstract void OnPause();
  30. /// <summary> Executes the 'resume' action. </summary>
  31. public abstract void OnResume();
  32. /// <summary> Updates this object. </summary>
  33. public abstract void Update();
  34. /// <summary> Executes the 'destroy' action. </summary>
  35. public abstract void OnDestroy();
  36. /// <summary> Trigger haptic vibration. </summary>
  37. /// <param name="controllerIndex"> Zero-based index of the controller.</param>
  38. /// <param name="durationSeconds"> (Optional) The duration in seconds.</param>
  39. /// <param name="frequency"> (Optional) The frequency.</param>
  40. /// <param name="amplitude"> (Optional) The amplitude.</param>
  41. public virtual void TriggerHapticVibration(int controllerIndex, float durationSeconds = 0.1f, float frequency = 200f, float amplitude = 0.8f) { }
  42. /// <summary> Recenters this object. </summary>
  43. public virtual void Recenter() { }
  44. }
  45. }