Files
Continentis/Assets/Plugins/AllIn1VfxToolkit/Demo & Assets/Demo/Scripts/AllIn1DoShake.cs

26 lines
760 B
C#
Raw Normal View History

2025-10-23 00:49:44 -04:00
using UnityEngine;
namespace AllIn1VfxToolkit.Demo.Scripts
{
public class AllIn1DoShake : MonoBehaviour
{
[SerializeField] private float shakeAmount = 0.15f;
[SerializeField] private bool doShakeOnStart;
[SerializeField] private float shakeOnStartDelay;
2026-03-20 11:56:50 -04:00
2025-10-23 00:49:44 -04:00
private void Start()
{
2026-03-20 11:56:50 -04:00
if (doShakeOnStart)
2025-10-23 00:49:44 -04:00
{
2026-03-20 11:56:50 -04:00
if (shakeOnStartDelay < Time.deltaTime) DoShake();
2025-10-23 00:49:44 -04:00
else Invoke(nameof(DoShake), shakeOnStartDelay);
}
}
public void DoShake()
{
2026-03-20 11:56:50 -04:00
if (AllIn1Shaker.i != null) AllIn1Shaker.i.DoCameraShake(shakeAmount);
else Debug.LogError("No AllIn1Shaker found. Please add one to the scene");
2025-10-23 00:49:44 -04:00
}
}
}