Пример #1
0
        /// <summary>
        /// When this feedback gets played
        /// </summary>
        /// <param name="position"></param>
        /// <param name="feedbacksIntensity"></param>
        protected override void CustomPlayFeedback(Vector3 position, float feedbacksIntensity = 1.0f)
        {
            if (!Active)
            {
                return;
            }

            switch (HapticMethod)
            {
            case HapticMethods.AdvancedPattern:

                string iOSString = (AHAPFileForIOS == null) ? "" : AHAPFileForIOS.text;

                long[] androidPattern   = (AndroidWaveFormFile == null) ? null : AndroidWaveFormFile.WaveForm.Pattern;
                int[]  androidAmplitude = (AndroidWaveFormFile == null) ? null : AndroidWaveFormFile.WaveForm.Amplitudes;

                long[] rumblePattern     = (RumbleWaveFormFile == null) ? null : RumbleWaveFormFile.WaveForm.Pattern;
                int[]  lowFreqAmplitude  = (RumbleWaveFormFile == null) ? null : RumbleWaveFormFile.WaveForm.LowFrequencyAmplitudes;
                int[]  highFreqAmplitude = (RumbleWaveFormFile == null) ? null : RumbleWaveFormFile.WaveForm.HighFrequencyAmplitudes;

                MMVibrationManager.AdvancedHapticPattern(APVibrateIOS, iOSString, APVibrateAndroid, androidPattern, androidAmplitude,
                                                         AndroidRepeat, APVibrateAndroidIfNoSupport, APRumble,
                                                         rumblePattern, lowFreqAmplitude, highFreqAmplitude, RumbleRepeat,
                                                         OldIOSFallback, this, ControllerID);
                break;

            case HapticMethods.Continuous:
                StartCoroutine(ContinuousHapticsCoroutine());
                break;

            case HapticMethods.NativePreset:
                MMVibrationManager.Haptic(HapticType, false, AllowRumble, this, ControllerID);
                break;

            case HapticMethods.Transient:
                MMVibrationManager.TransientHaptic(TransientIntensity, TransientSharpness, AllowRumble, this, ControllerID);
                break;

            case HapticMethods.AdvancedTransient:
                MMVibrationManager.TransientHaptic(ATVibrateIOS, ATIOSIntensity, ATIOSSharpness, ATVibrateAndroid,
                                                   ATAndroidIntensity, ATAndroidSharpness, ATVibrateAndroidIfNoSupport, ATRumble,
                                                   ATRumbleIntensity, ATRumbleSharpness, ATRumbleControllerID, this);
                break;

            case HapticMethods.AdvancedContinuous:

                break;

            case HapticMethods.Stop:
                if (_continuousPlaying)
                {
                    MMVibrationManager.StopContinuousHaptic(AllowRumble);
                    _continuousPlaying = false;
                }
                break;
            }
        }