/// <summary> /// Start a vibration with a long[] pattern (milliseconds) and the int[] amplitudes (0 to 250) /// </summary> /// <param name="pattern"></param> /// <param name="amplitudes"></param> public static void Vibrate(long[] pattern, int[] amplitudes) { if (!NativeVibration.Instance) { return; } #if UNITY_EDITOR #elif UNITY_IOS #elif UNITY_ANDROID NativeVibrationAndroid.Vibrate(pattern, amplitudes, -1); #endif }
/// <summary> /// Start a vibration of milliseconds lenght and amplitude strenght (-1 is default, up to 250) /// </summary> /// <param name="milliseconds"></param> /// <param name="amplitude"></param> public static void Vibrate(long milliseconds = 100, int amplitude = -1) { if (!NativeVibration.Instance) { return; } #if UNITY_EDITOR #elif UNITY_IOS #elif UNITY_ANDROID NativeVibrationAndroid.Vibrate(milliseconds, amplitude); #endif }
/// <summary> /// Cancel any vibration /// </summary> public static void Cancel() { if (!NativeVibration.Instance) { return; } #if UNITY_EDITOR #elif UNITY_IOS #elif UNITY_ANDROID NativeVibrationAndroid.Cancel(); #endif }
/// <summary> /// Is this device able to control amplitude of vibration /// </summary> /// <returns>boolean</returns> public static bool IsAmplitudeAvailable() { if (!NativeVibration.Instance) { return(false); } #if UNITY_EDITOR return(false); #elif UNITY_IOS // not implemented return(false); #elif UNITY_ANDROID return(NativeVibrationAndroid.HasAmplitudeControl()); #else return(false); #endif }