44using Microsoft . MixedReality . Toolkit . Input ;
55using Microsoft . MixedReality . Toolkit . Utilities ;
66using Microsoft . MixedReality . Toolkit . Windows . Utilities ;
7+ using Microsoft . MixedReality . Toolkit . WindowsMixedReality ;
78using Microsoft . MixedReality . Toolkit . XRSDK . Input ;
89using System ;
9- using System . Linq ;
10- using System . Collections . Generic ;
11- using UnityEngine ;
1210using UnityEngine . XR ;
13- using UnityEngine . XR . Management ;
14- #if WMR_ENABLED
15- using UnityEngine . XR . WindowsMR ;
16- #endif
17- using Unity . Profiling ;
18- using Microsoft . MixedReality . Toolkit . WindowsMixedReality ;
1911
2012#if HP_CONTROLLER_ENABLED
2113using Microsoft . MixedReality . Input ;
2214using MotionControllerHandedness = Microsoft . MixedReality . Input . Handedness ;
23- using Handedness = Microsoft . MixedReality . Toolkit . Utilities . Handedness ;
15+ using System . Collections . Generic ;
16+ using Unity . Profiling ;
2417#endif
2518
2619#if WINDOWS_UWP
@@ -72,7 +65,7 @@ public override void Enable()
7265 {
7366 return ;
7467 }
75- #endif
68+ #endif // WMR_ENABLED
7669
7770 if ( WindowsMixedRealityUtilities . UtilitiesProvider == null )
7871 {
@@ -87,7 +80,7 @@ public override void Enable()
8780 motionControllerWatcher . MotionControllerAdded += AddTrackedMotionController ;
8881 motionControllerWatcher . MotionControllerRemoved += RemoveTrackedMotionController ;
8982 var nowait = motionControllerWatcher . StartAsync ( ) ;
90- #endif
83+ #endif // HP_CONTROLLER_ENABLED
9184 }
9285
9386 /// <inheritdoc />
@@ -161,7 +154,7 @@ public override bool CheckCapability(MixedRealityCapability capability)
161154 private readonly Dictionary < uint , MotionControllerState > trackedMotionControllerStates = new Dictionary < uint , MotionControllerState > ( ) ;
162155
163156 private readonly Dictionary < uint , GenericXRSDKController > activeMotionControllers = new Dictionary < uint , GenericXRSDKController > ( ) ;
164- #endif
157+ #endif // HP_CONTROLLER_ENABLED
165158
166159 #endregion IMixedRealityCapabilityCheck Implementation
167160
@@ -177,7 +170,7 @@ protected override GenericXRSDKController GetOrAddController(InputDevice inputDe
177170 {
178171 return null ;
179172 }
180- #endif
173+ #endif // WMR_ENABLED
181174
182175 using ( GetOrAddControllerPerfMarker . Auto ( ) )
183176 {
@@ -228,29 +221,25 @@ private void RemoveTrackedMotionController(object sender, MotionController motio
228221 }
229222 }
230223 }
231- #endif
232224
233- #if HP_CONTROLLER_ENABLED
234- // Creates a unique key for the controller based on it's vendor ID, product ID, version number, and handedness
225+ // Creates a unique key for the controller based on its vendor ID, product ID, version number, and handedness
235226 private uint GetControllerId ( uint handedness )
236227 {
237228 return handedness ;
238229 }
239230
240- #if HP_CONTROLLER_ENABLED
241231 private uint GetControllerId ( MotionController mc )
242232 {
243- var handedness = ( ( uint ) ( mc . Handedness == MotionControllerHandedness . Right ? 2 : ( mc . Handedness == MotionControllerHandedness . Left ? 1 : 0 ) ) ) ;
233+ var handedness = ( uint ) ( mc . Handedness == MotionControllerHandedness . Right ? 2 : ( mc . Handedness == MotionControllerHandedness . Left ? 1 : 0 ) ) ;
244234 return GetControllerId ( handedness ) ;
245235 }
246- #endif
247236
248237 private uint GetControllerId ( InputDevice inputDevice )
249238 {
250- var handedness = ( ( uint ) ( inputDevice . characteristics . HasFlag ( InputDeviceCharacteristics . Right ) ? 2 : inputDevice . characteristics . HasFlag ( InputDeviceCharacteristics . Left ) ? 1 : 0 ) ) ;
239+ var handedness = ( uint ) ( inputDevice . characteristics . HasFlag ( InputDeviceCharacteristics . Right ) ? 2 : ( inputDevice . characteristics . HasFlag ( InputDeviceCharacteristics . Left ) ? 1 : 0 ) ) ;
251240 return GetControllerId ( handedness ) ;
252241 }
253- #endif
242+ #endif // HP_CONTROLLER_ENABLED
254243
255244 /// <inheritdoc />
256245 protected override Type GetControllerType ( SupportedControllerType supportedControllerType )
@@ -260,7 +249,8 @@ protected override Type GetControllerType(SupportedControllerType supportedContr
260249 {
261250 return null ;
262251 }
263- #endif
252+ #endif // WMR_ENABLED
253+
264254 switch ( supportedControllerType )
265255 {
266256 case SupportedControllerType . WindowsMixedReality :
0 commit comments