using Fort23.UTool; using UnityEngine; namespace Core.UI.UTool.UITween { [System.Serializable] public class TweenPlayFx : TweenBasic { protected bool isPalyFx; protected ParticleSystem[] particleSystems; public GameObject GetCanvasGroup(Object CanvasGroup) { GameObject graphic = CanvasGroup as GameObject; if (graphic == null) { GameObject gameObject = CanvasGroup as GameObject; if (gameObject != null) { graphic = gameObject; } } return graphic; } protected override void ProPlay(Object CanvasGroup, float allTime) { GameObject graphic = GetCanvasGroup(CanvasGroup); if (graphic == null) { return; } if (!isPalyFx) { particleSystems = graphic.transform.GetComponentsInChildren(); isPalyFx = true; for (int i = 0; i < particleSystems.Length; i++) { particleSystems[i].Stop(); particleSystems[i].Clear(true); particleSystems[i].Play(true); } } } protected override void ProRest(Object CanvasGroup) { isPalyFx = false; } } }