rabidus-test/Assets/VibrationEffect.cs

30 lines
523 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class VibrationEffect : MonoBehaviour
{
public VibrationSettings Settings;
private HapticsEffect haptics;
public bool DoVibration = false;
private void Awake()
{
haptics = FindObjectOfType<HapticsEffect>();
}
[ContextMenu("Vibrate")]
public void Vibrate()
{
haptics.Vibrate(Settings);
}
private void Update()
{
if (DoVibration)
Vibrate();
}
}