# Vibration Manager

> Powered by NiceVibrations (FEEL) package

You can call <mark style="color:green;">**VibrationManager.cs**</mark> anywere even if it's not replaced in scene.

namespace **`using Game.Core;`**

## API

{% code lineNumbers="true" %}

```csharp
public static VibrationsManager Instance;

// This is cooldown between vibrations call, 0.2 seconds by default
// Any vibration call before cooldown elapsed will be ignored
private Cooldown hapticCooldown = new Cooldown(0.2f);

// Is user settings vibro enabled
public bool HapticEnabled;

// Triggers vibration with hapticType pattern
public void DoVibro(HapticPatterns.PresetType hapticType);
```

{% endcode %}

## Where is already used

[<mark style="color:green;">**VibroBtn.cs**</mark>](https://reddycat.gitbook.io/base-project-cube-doc/fundamentals/ready-to-use-scipts/vibro-button) that is Button class inheritance, place it on button in UI that will trigger vibro on click.

```csharp
public class VibroBtn : Button {
    public HapticPatterns.PresetType vibrationType;

    protected override void Start() {
        base.Start();
        onClick.AddListener(() => VibrationsManager.Instance.DoVibro(vibrationType));
    }
}
```

## Example how to use

```csharp
private void OnPlayerHit() {
    VibrationsManager.Instance.DoVibro(HapticPatterns.PresetType.MediumImpact);
}
```
