暫無描述
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. ////REVIEW: Devices usually will automatically shut down haptics if they haven't received a haptics command in some time.
  2. //// How should we deal with that? Should haptics automatically refresh themselves periodically while they are set?
  3. ////REVIEW: Do we need a mute in addition to a pause?
  4. namespace UnityEngine.InputSystem.Haptics
  5. {
  6. /// <summary>
  7. /// Base interface for haptics on input devices.
  8. /// </summary>
  9. /// <remarks>
  10. /// To support haptics, an <see cref="InputDevice"/> has to implement one or more
  11. /// haptics interfaces.
  12. /// </remarks>
  13. /// <example>
  14. /// <code>
  15. /// class MyDevice : InputDevice, IDualMotorRumble
  16. /// {
  17. /// private DualMotorRumble m_Rumble;
  18. ///
  19. /// public void SetMotorSpeeds(float lowFrequency, float highFrequency)
  20. /// {
  21. /// m_Rumble.SetMotorSpeeds(lowFrequency, highFrequency);
  22. /// }
  23. ///
  24. /// public void PauseHaptics()
  25. /// {
  26. /// m_Rumble.PauseHaptics();
  27. /// }
  28. ///
  29. /// public void ResumeHaptics()
  30. /// {
  31. /// m_Rumble.ResumeHaptics();
  32. /// }
  33. ///
  34. /// public void ResetHaptics()
  35. /// {
  36. /// m_Rumble.ResetHaptics();
  37. /// }
  38. /// }
  39. /// </code>
  40. /// </example>
  41. /// <seealso cref="InputSystem.PauseHaptics"/>
  42. /// <seealso cref="InputSystem.ResumeHaptics"/>
  43. /// <seealso cref="InputSystem.ResetHaptics"/>
  44. public interface IHaptics
  45. {
  46. /// <summary>
  47. /// Pause haptics playback on the device.
  48. /// </summary>
  49. /// <remarks>
  50. /// This should preserve current playback settings (such as motor speed levels
  51. /// or effect playback positions) but shut down feedback effects on the device.
  52. ///
  53. /// If proper resumption of effects is not possible, playback should be stopped
  54. /// and <see cref="ResumeHaptics"/> is allowed to be a no-operation.
  55. ///
  56. /// Note that haptics playback states are not required to survive domain reloads
  57. /// in the editor.
  58. /// </remarks>
  59. /// <seealso cref="ResumeHaptics"/>
  60. void PauseHaptics();
  61. /// <summary>
  62. /// Resume haptics playback on the device.
  63. /// </summary>
  64. /// <remarks>
  65. /// Should be called after calling <see cref="PauseHaptics"/>. Otherwise does
  66. /// nothing.
  67. /// </remarks>
  68. void ResumeHaptics();
  69. /// <summary>
  70. /// Reset haptics playback on the device to its default state.
  71. /// </summary>
  72. /// <remarks>
  73. /// This will turn off all haptics effects that may be playing on the device.
  74. /// </remarks>
  75. void ResetHaptics();
  76. }
  77. }