123456789101112131415161718192021222324252627282930313233343536 |
- 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<ParticleSystem> particleSystems = new List<ParticleSystem>();
- gameObject.GetComponentsInChildren<ParticleSystem>(particleSystems);
- var s = gameObject.GetComponent<ParticleSystem>();
- 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);
- }));
- }
-
- }
- }
- }
|