Skip to content

Commit 352efb2

Browse files
committed
Update extensions to return bool
1 parent 6725581 commit 352efb2

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Assets/MRTK/Providers/WindowsMixedReality/XR2018/Extensions/InteractionSourceExtensions.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,19 +77,19 @@ public static SpatialInteractionSourceState GetSpatialInteractionSourceState(thi
7777
/// </summary>
7878
/// <param name="interactionSource">The source to start haptics on.</param>
7979
/// <param name="intensity">The strength of the haptic feedback from 0.0 (no haptics) to 1.0 (maximum strength).</param>
80-
public static void StartHaptics(this InteractionSource interactionSource, float intensity) => interactionSource.StartHaptics(intensity, float.MaxValue);
80+
public static bool StartHaptics(this InteractionSource interactionSource, float intensity) => interactionSource.StartHaptics(intensity, float.MaxValue);
8181

8282
/// <summary>
8383
/// Start haptic feedback on the interaction source with the specified intensity and continue for the specified amount of time.
8484
/// </summary>
8585
/// <param name="interactionSource">The source to start haptics on.</param>
8686
/// <param name="intensity">The strength of the haptic feedback from 0.0 (no haptics) to 1.0 (maximum strength).</param>
8787
/// <param name="durationInSeconds">The time period expressed in seconds.</param>
88-
public static void StartHaptics(this InteractionSource interactionSource, float intensity, float durationInSeconds)
88+
public static bool StartHaptics(this InteractionSource interactionSource, float intensity, float durationInSeconds)
8989
{
9090
if (!IsHapticsAvailable)
9191
{
92-
return;
92+
return false;
9393
}
9494

9595
#if WINDOWS_UWP || DOTNETWINRT_PRESENT
@@ -106,10 +106,12 @@ public static void StartHaptics(this InteractionSource interactionSource, float
106106
{
107107
simpleHapticsController.SendHapticFeedbackForDuration(hapticsFeedback, intensity, TimeSpan.FromSeconds(durationInSeconds));
108108
}
109-
return;
109+
return true;
110110
}
111111
}
112112
#endif // WINDOWS_UWP || DOTNETWINRT_PRESENT
113+
114+
return false;
113115
}
114116

115117
/// <summary>

0 commit comments

Comments
 (0)