using System; using System.Collections; using System.Collections.Generic; using UnityEngine; public class ParticleController : MonoBehaviour { public Action OnParticleEnd; public ParticleSystem ParticleSys; void Awake() { ParticleSys = GetComponent(); var main = ParticleSys.main; main.stopAction = ParticleSystemStopAction.Callback; } public void Play() { this.ParticleSys.Play(); } public void Stop() { this.ParticleSys.Stop(); } public void Pause() { this.ParticleSys.Pause(); } public void OnParticleSystemStopped() { this.OnParticleEnd?.Invoke(); } }