public void OnImpactHeavy()
 {
     IGHapticFeedback.ImpactOccurred(IGHapticFeedback.ImpactType.Heavy);
 }
 public void OnImpactLight()
 {
     IGHapticFeedback.ImpactOccurred(IGHapticFeedback.ImpactType.Light);
 }
 public void OnImpactMedium()
 {
     IGHapticFeedback.ImpactOccurred(IGHapticFeedback.ImpactType.Medium);
 }
 public void OnSelected()
 {
     IGHapticFeedback.SelectionChanged();
 }
 public void OnNotificationSuccess()
 {
     IGHapticFeedback.NotificationOccurred(IGHapticFeedback.NotificationType.Success);
 }
 public void OnNotificationWarning()
 {
     IGHapticFeedback.NotificationOccurred(IGHapticFeedback.NotificationType.Warning);
 }
 public void OnNotificationError()
 {
     IGHapticFeedback.NotificationOccurred(IGHapticFeedback.NotificationType.Error);
 }
Beispiel #8
0
    public static void HapticEvent(HEvent e)
    {
    #if UNITY_IOS
        bool available = IGHapticFeedback.IsHapticFeedbackSupported;
    #elif UNITY_ANDROID
        bool available = AGVibrator.HasVibrator();
    #endif

        if (!available)
        {
            return;
        }

        switch (e)
        {
        case HEvent.Select:
        #if UNITY_IOS
            IGHapticFeedback.SelectionChanged();
        #elif UNITY_ANDROID
            AGVibrator.Vibrate(VibrationEffect.CreateOneShot(400, 120));
        #endif
            break;

        case HEvent.Delete:
        #if UNITY_IOS
            IGHapticFeedback.ImpactOccurred(IGHapticFeedback.ImpactType.Medium);
        #elif UNITY_ANDROID
            AGVibrator.Vibrate(VibrationEffect.CreateOneShot(600, 170));
        #endif
            break;

        case HEvent.Deleted:
        #if UNITY_IOS
            IGHapticFeedback.ImpactOccurred(IGHapticFeedback.ImpactType.Heavy);
        #elif UNITY_ANDROID
            AGVibrator.Vibrate(VibrationEffect.CreateOneShot(600, 250));
        #endif
            break;

        case HEvent.Click:
        #if UNITY_IOS
            IGHapticFeedback.ImpactOccurred(IGHapticFeedback.ImpactType.Light);
        #elif UNITY_ANDROID
            AGVibrator.Vibrate(VibrationEffect.CreateOneShot(300, 100));
        #endif
            break;

        case HEvent.Error:
        #if UNITY_IOS
            IGHapticFeedback.NotificationOccurred(IGHapticFeedback.NotificationType.Error);
        #elif UNITY_ANDROID
            AGVibrator.Vibrate(VibrationEffect.CreateWaveForm(error_pattern, error_amplitude, -1));
        #endif
            break;

        case HEvent.Warning:
        #if UNITY_IOS
            IGHapticFeedback.NotificationOccurred(IGHapticFeedback.NotificationType.Warning);
        #elif UNITY_ANDROID
            AGVibrator.Vibrate(VibrationEffect.CreateWaveForm(warning_pattern, warning_amplitude, -1));
        #endif
            break;

        case HEvent.Success:
        #if UNITY_IOS
            IGHapticFeedback.NotificationOccurred(IGHapticFeedback.NotificationType.Success);
        #elif UNITY_ANDROID
            AGVibrator.Vibrate(VibrationEffect.CreateWaveForm(success_pattern, success_amplitude, -1));
        #endif
            break;
        }
    }