// AHAP ------------------------------------------------------------------------------------------------ public virtual void PlayAHAP(int index) { Logo.Shaking = true; // for the purpose of the demo, and to be able to observe the difference, if any, on certain devices, // the first 4 effects (dice, drums, game over, heart beats) will be called on the main thread, and the remaining ones on a secondary thread if (index < 5) { MMVibrationManager.AdvancedHapticPattern(DemoItems[index].AHAPFile.text, DemoItems[index].WaveFormAsset.WaveForm.Pattern, DemoItems[index].WaveFormAsset.WaveForm.Amplitudes, -1, DemoItems[index].RumbleWaveFormAsset.WaveForm.Pattern, DemoItems[index].RumbleWaveFormAsset.WaveForm.LowFrequencyAmplitudes, DemoItems[index].RumbleWaveFormAsset.WaveForm.HighFrequencyAmplitudes, -1, HapticTypes.LightImpact, this, -1, false); DemoItems[index].AssociatedSound.Play(); StartCoroutine(ChangeIcon(DemoItems[index].AssociatedSprite)); } else { MMVibrationManager.AdvancedHapticPattern(DemoItems[index].AHAPFile.text, DemoItems[index].WaveFormAsset.WaveForm.Pattern, DemoItems[index].WaveFormAsset.WaveForm.Amplitudes, -1, DemoItems[index].RumbleWaveFormAsset.WaveForm.Pattern, DemoItems[index].RumbleWaveFormAsset.WaveForm.LowFrequencyAmplitudes, DemoItems[index].RumbleWaveFormAsset.WaveForm.HighFrequencyAmplitudes, -1, HapticTypes.LightImpact, this, -1, true); DemoItems[index].AssociatedSound.Play(); StartCoroutine(ChangeIcon(DemoItems[index].AssociatedSprite)); } }
// AHAP ------------------------------------------------------------------------------------------------ public virtual void PlayAHAP(int index) { Logo.Shaking = true; MMVibrationManager.AdvancedHapticPattern(DemoItems[index].AHAPFile.text, DemoItems[index].WaveFormAsset.WaveForm.Pattern, DemoItems[index].WaveFormAsset.WaveForm.Amplitudes, -1, HapticTypes.LightImpact); DemoItems[index].AssociatedSound.Play(); StartCoroutine(ChangeIcon(DemoItems[index].AssociatedSprite)); }
public virtual void OnPointerExit(PointerEventData data) { _eventPosition = _pointerEventData.position; _newTargetPosition = GetWorldPosition(_eventPosition); _newTargetPosition = Vector2.ClampMagnitude(_newTargetPosition - _neutralPosition, MaxRange); _newTargetPosition = _neutralPosition + _newTargetPosition; _newTargetPosition.z = _initialZPosition; _dragging = false; _dragEndedPosition = _newTargetPosition; _dragEndedAt = Time.time; _dragResetDirection = _dragEndedPosition - _neutralPosition; _pointerOn = false; TargetAnimator.SetTrigger(_sparkAnimationParameter); SpringAudioSource.Play(); MMVibrationManager.AdvancedHapticPattern(AHAPFile.text, _wobbleAndroidPattern, _wobbleAndroidAmplitude, -1, HapticTypes.LightImpact); }
/// <summary> /// When this feedback gets played /// </summary> /// <param name="position"></param> /// <param name="attenuation"></param> protected virtual void TestVibration() { Vector3 position = this.transform.position; 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(iOSString, androidPattern, androidAmplitude, AndroidRepeat, rumblePattern, lowFreqAmplitude, highFreqAmplitude, RumbleRepeat, OldIOSFallback, this); break; case HapticMethods.Continuous: StartCoroutine(ContinuousHapticsCoroutine()); break; case HapticMethods.NativePreset: MMVibrationManager.Haptic(HapticType, false, AllowRumble, this); break; case HapticMethods.Transient: MMVibrationManager.TransientHaptic(TransientIntensity, TransientSharpness, AllowRumble, this); break; case HapticMethods.Stop: if (_continuousPlaying) { MMVibrationManager.StopContinuousHaptic(AllowRumble); _continuousPlaying = false; } break; } }