26 lines
760 B
C#
26 lines
760 B
C#
using UnityEngine;
|
|
|
|
namespace AllIn1VfxToolkit.Demo.Scripts
|
|
{
|
|
public class AllIn1DoShake : MonoBehaviour
|
|
{
|
|
[SerializeField] private float shakeAmount = 0.15f;
|
|
[SerializeField] private bool doShakeOnStart;
|
|
[SerializeField] private float shakeOnStartDelay;
|
|
|
|
private void Start()
|
|
{
|
|
if (doShakeOnStart)
|
|
{
|
|
if (shakeOnStartDelay < Time.deltaTime) DoShake();
|
|
else Invoke(nameof(DoShake), shakeOnStartDelay);
|
|
}
|
|
}
|
|
|
|
public void DoShake()
|
|
{
|
|
if (AllIn1Shaker.i != null) AllIn1Shaker.i.DoCameraShake(shakeAmount);
|
|
else Debug.LogError("No AllIn1Shaker found. Please add one to the scene");
|
|
}
|
|
}
|
|
} |