SamsonGame/Assets/Scripts/Managers/Vibration/Vibration.cs

68 lines
2.0 KiB
C#

using MoreMountains.NiceVibrations;
using UnityEngine;
namespace RND
{
public static class Vibration
{
private static bool VibrationOn => GameSettings.VibrationIsActive && MMVibrationManager.HapticsSupported();
public static void VibrateLight()
{
if (VibrationOn)
MMVibrationManager.Haptic(HapticTypes.LightImpact);
}
public static void VibrateMedium()
{
if (VibrationOn)
MMVibrationManager.Haptic(HapticTypes.MediumImpact);
}
public static void VibrateHeavy()
{
if (VibrationOn)
MMVibrationManager.Haptic(HapticTypes.HeavyImpact);
}
public static void VibrateFailure()
{
if (VibrationOn)
MMVibrationManager.Haptic(HapticTypes.Failure);
}
public static void VibrateSuccess()
{
if (VibrationOn)
MMVibrationManager.Haptic(HapticTypes.Success);
}
public static void VibrateWarning()
{
if (VibrationOn)
MMVibrationManager.Haptic(HapticTypes.Warning);
}
public static void VibrateCustom(float intensity, float sharpness, float duration,
HapticTypes fallbackOldiOS = HapticTypes.None, MonoBehaviour mono = null, bool alsoRumble = false,
int controllerID = -1, bool threaded = true, bool fullIntensity = true)
{
if (VibrationOn)
MMVibrationManager.ContinuousHaptic(intensity, sharpness, duration, fallbackOldiOS, mono, alsoRumble,
controllerID, threaded, fullIntensity);
}
public static void StopAllHaptics()
{
if (VibrationOn)
MMVibrationManager.StopAllHaptics();
}
public static void StopContinuousHaptic()
{
if (VibrationOn)
MMVibrationManager.StopContinuousHaptic();
}
}
}