A game about forced loneliness, made by TACStudios
at master 1.7 kB view raw
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 3using System.Runtime.InteropServices; 4using UnityEngine.InputSystem.LowLevel; 5using UnityEngine.InputSystem.Utilities; 6 7namespace UnityEngine.InputSystem.XR.Haptics 8{ 9 public struct HapticState 10 { 11 public HapticState(uint samplesQueued, uint samplesAvailable) 12 { 13 this.samplesQueued = samplesQueued; 14 this.samplesAvailable = samplesAvailable; 15 } 16 17 public uint samplesQueued { get; private set; } 18 public uint samplesAvailable { get; private set; } 19 } 20 21 [StructLayout(LayoutKind.Explicit, Size = kSize)] 22 public struct GetCurrentHapticStateCommand : IInputDeviceCommandInfo 23 { 24 static FourCC Type => new FourCC('X', 'H', 'S', '0'); 25 26 const int kSize = InputDeviceCommand.kBaseCommandSize + (sizeof(uint) * 2); 27 28 public FourCC typeStatic => Type; 29 30 [FieldOffset(0)] 31 InputDeviceCommand baseCommand; 32 33 [FieldOffset(InputDeviceCommand.kBaseCommandSize)] 34 public uint samplesQueued; 35 36 [FieldOffset(InputDeviceCommand.kBaseCommandSize + sizeof(int))] 37 public uint samplesAvailable; 38 39 public HapticState currentState => new HapticState(samplesQueued, samplesAvailable); 40 41 public static GetCurrentHapticStateCommand Create() 42 { 43 return new GetCurrentHapticStateCommand 44 { 45 baseCommand = new InputDeviceCommand(Type, kSize), 46 }; 47 } 48 } 49} 50#endif