/// <summary> /// Cancels any current running haptic routine. /// </summary> protected override void DoCancel() { if (hapticRoutine == null) { return; } StopCoroutine(hapticRoutine); hapticRoutine = null; HapticProcess.Cancel(); }
/// <summary> /// Enumerates for the specified duration calling <see cref="HapticProcess"/> with a specified interval delay between each call. /// </summary> /// <returns>An Enumerator to manage the running of the Coroutine.</returns> protected virtual IEnumerator HapticProcessRoutine() { if (Interval <= 0) { yield break; } float currentDuration = Duration; while (currentDuration > 0) { HapticProcess.Begin(); yield return(delayYieldInstruction); currentDuration -= Interval; } }
/// <inheritdoc /> public override bool IsActive() { return(base.IsActive() && HapticProcess != null && HapticProcess.IsActive()); }