using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace ToadieTechnika.GGJ2018Game
{
    public class ParticleScript : PoolableObject
    {
        [SerializeField]
        ParticleSystem m_ParticleSystem;

        void OnEnable()
        {
            StopCoroutine("AutoDestroy");
            StartCoroutine("AutoDestroy");
        }

        IEnumerator AutoDestroy()
        {
            yield return new WaitForSeconds(m_ParticleSystem.main.duration);
            RemoveObject();
        }
    }
}