Keine Beschreibung
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

GetCurrentHapticStateCommand.cs 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. // ENABLE_VR is not defined on Game Core but the assembly is available with limited features when the XR module is enabled.
  2. #if UNITY_INPUT_SYSTEM_ENABLE_XR && (ENABLE_VR || UNITY_GAMECORE) || PACKAGE_DOCS_GENERATION
  3. using System.Runtime.InteropServices;
  4. using UnityEngine.InputSystem.LowLevel;
  5. using UnityEngine.InputSystem.Utilities;
  6. namespace UnityEngine.InputSystem.XR.Haptics
  7. {
  8. public struct HapticState
  9. {
  10. public HapticState(uint samplesQueued, uint samplesAvailable)
  11. {
  12. this.samplesQueued = samplesQueued;
  13. this.samplesAvailable = samplesAvailable;
  14. }
  15. public uint samplesQueued { get; private set; }
  16. public uint samplesAvailable { get; private set; }
  17. }
  18. [StructLayout(LayoutKind.Explicit, Size = kSize)]
  19. public struct GetCurrentHapticStateCommand : IInputDeviceCommandInfo
  20. {
  21. static FourCC Type => new FourCC('X', 'H', 'S', '0');
  22. const int kSize = InputDeviceCommand.kBaseCommandSize + (sizeof(uint) * 2);
  23. public FourCC typeStatic => Type;
  24. [FieldOffset(0)]
  25. InputDeviceCommand baseCommand;
  26. [FieldOffset(InputDeviceCommand.kBaseCommandSize)]
  27. public uint samplesQueued;
  28. [FieldOffset(InputDeviceCommand.kBaseCommandSize + sizeof(int))]
  29. public uint samplesAvailable;
  30. public HapticState currentState => new HapticState(samplesQueued, samplesAvailable);
  31. public static GetCurrentHapticStateCommand Create()
  32. {
  33. return new GetCurrentHapticStateCommand
  34. {
  35. baseCommand = new InputDeviceCommand(Type, kSize),
  36. };
  37. }
  38. }
  39. }
  40. #endif