using System.Collections; using System.Collections.Generic; using UnityEngine; using QFSW.MOP2; namespace KairoEngine.Core { public class FxController : MonoBehaviour { public bool autoRemoveFx = true; public string fxName = ""; public float removeTime = 3f; void Awake() { // Get all particle systems List particleSystems = new List(); gameObject.GetComponentsInChildren(particleSystems); var s = gameObject.GetComponent(); if(s != null) particleSystems.Add(s); // Reset Parcile Systems foreach (var particleSystem in particleSystems) { particleSystem.Clear(); particleSystem.Play(); } if(autoRemoveFx) { StartCoroutine(Timer.Start(removeTime, false, () => { MasterObjectPooler.Instance.GetPool(fxName).Release(this.gameObject); })); } } } }