using UnityEngine;

namespace BingoBrain.Core
{
    public class Lucsah : MonoBehaviour
    {
        private float lastTime;
        private ParticleSystem particle;

        private void Awake()
        {
            InitData();
        }

        private void Update()
        {
            OnUpdateParticleTime();
        }

        private void InitData()
        {
            particle = GetComponent<ParticleSystem>();
            lastTime = Time.realtimeSinceStartup;
        }

        private void OnUpdateParticleTime()
        {
            var realtimeSinceStartup = Time.realtimeSinceStartup;
            var deltaTime = realtimeSinceStartup - lastTime;
            particle.Simulate(deltaTime, true, false);
            lastTime = realtimeSinceStartup;
        }
    }
}