ProjectDDD/Assets/Plugins/AllIn1VfxToolkit/Demo & Assets/Demo/Scripts/AllIn1DoShake.cs
2025-07-08 19:46:31 +09:00

26 lines
766 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");
}
}
}