rabidus-test/Assets/VibrationEffect.cs

30 lines
523 B
C#
Raw Normal View History

2023-10-19 11:04:15 +03:00
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();
}
}