using System.Collections.Generic; using UnityEngine; namespace Wizard; public class UIParticleEffectManager : MonoBehaviour { [SerializeField] private GameObject _groupPrefab; private static readonly Vector3 START_POSITION = new Vector3(4000f, 0f, 0f); private static readonly Vector3 OFFSET_POSITION = new Vector3(4000f, 0f, 0f); private int _groupCount; private List _groupList = new List(); public static UIParticleEffectManager Instance { get; private set; } private void Awake() { Instance = this; } public void Remove(UIParticleEffectGroup group) { if (_groupList.Remove(group)) { group.OnBeforeDestroy(); Object.Destroy(group.gameObject); } } public UIParticleEffectGroup CreateNewGroup(UITexture uiTexture) { GameObject obj = NGUITools.AddChild(base.gameObject, _groupPrefab); UIParticleEffectGroup component = obj.GetComponent(); component.Initialize(uiTexture); obj.transform.localPosition = START_POSITION + OFFSET_POSITION * _groupCount; _groupCount++; _groupList.Add(component); return component; } }