void ITapticEngineInternal.Play(TapticType type, float duration, float strength) { if (this.isMuted == true) { return; } this.bridge.Play(type, duration, strength); }
void ITapticBridge.Play(TapticType type, float duration, float strength) { if (duration <= 0f || strength <= 0f) { this.Haptic(type); } else { this.AndroidVibrate((long)(duration * 1000f), (byte)Mathf.Clamp(1, 255, strength)); } }
void ITapticEngine.PlaySingle(TapticType type) { if (this.isMuted == true) { return; } if (this.activeModule != null) { this.activeModule.PlaySingle(type); } }
void ITapticBridge.Play(TapticType type, float duration, float strength) { if (type == TapticType.Vibrate) { Handheld.Vibrate(); return; } if (TapticBridgeiOS.iPhone6s() == true) { TapticBridgeiOS.ME_PlayTaptic6s((int)type); } else { TapticBridgeiOS.ME_PlayTaptic((int)type); } }
public void Haptic(TapticType type) { try { switch (type) { case TapticType.Selection: this.AndroidVibrate(TapticBridgeAndroid.LightDuration, TapticBridgeAndroid.LightAmplitude); break; case TapticType.Success: this.AndroidVibrate(TapticBridgeAndroid._successPattern, TapticBridgeAndroid._successPatternAmplitude, -1); break; case TapticType.Warning: this.AndroidVibrate(TapticBridgeAndroid._warningPattern, TapticBridgeAndroid._warningPatternAmplitude, -1); break; case TapticType.Failure: this.AndroidVibrate(TapticBridgeAndroid._failurePattern, TapticBridgeAndroid._failurePatternAmplitude, -1); break; case TapticType.Light: this.AndroidVibrate(TapticBridgeAndroid.LightDuration, TapticBridgeAndroid.LightAmplitude); break; case TapticType.Medium: this.AndroidVibrate(TapticBridgeAndroid.MediumDuration, TapticBridgeAndroid.MediumAmplitude); break; case TapticType.Heavy: this.AndroidVibrate(TapticBridgeAndroid.HeavyDuration, TapticBridgeAndroid.HeavyAmplitude); break; case TapticType.Vibrate: Handheld.Vibrate(); break; } } catch (System.NullReferenceException e) { Debug.Log(e.StackTrace); } }
public static void Call(TapticType tapticType) { switch (tapticType) { case TapticType.ImpactHeavy: case TapticType.ImpactMedium: case TapticType.ImpactLight: Impact(Convert <ImpactFeedback>(tapticType)); break; case TapticType.NotificationSuccess: case TapticType.NotificationWarning: case TapticType.NotificationError: Notification(Convert <NotificationFeedback>(tapticType)); break; case TapticType.Selection: Selection(); break; } }
public static T Convert <T>(TapticType tapticType) where T : struct, IConvertible { int value; switch (tapticType) { case TapticType.ImpactLight: value = (int)ImpactFeedback.Light; break; case TapticType.ImpactMedium: value = (int)ImpactFeedback.Medium; break; case TapticType.ImpactHeavy: value = (int)ImpactFeedback.Heavy; break; case TapticType.NotificationSuccess: value = (int)NotificationFeedback.Success; break; case TapticType.NotificationWarning: value = (int)NotificationFeedback.Warning; break; case TapticType.NotificationError: value = (int)NotificationFeedback.Error; break; case TapticType.Selection: default: return(default); } return((T)(object)value); }
private void PlaySingle_INTERNAL(TapticType type, float duration, float strength) { this.engine.Play(type, duration, strength); }
void ITapticModule.PlaySingle(TapticType type) { this.PlaySingle_INTERNAL(type, -1f, -1f); }
void ITapticBridge.Play(TapticType type, float duration, float strength) { #if UNITY_EDITOR UnityEngine.Debug.Log("Play Vibration " + type + " with duration " + duration + ", amplitude: " + strength); #endif }