2026-01-15 05:28:45 +00:00
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
public class EffectMgr : MonoBehaviourSingletonTemplate<EffectMgr>
|
|
|
|
|
{
|
|
|
|
|
[Header("Pool Setting")]
|
|
|
|
|
public Transform tf_parent;
|
|
|
|
|
|
|
|
|
|
Dictionary<string, List<GameObject>> dic_effect= new Dictionary<string, List<GameObject>>();
|
|
|
|
|
|
|
|
|
|
public void AllOff()
|
|
|
|
|
{
|
|
|
|
|
// 부모 아래에 있는 모든 Projectile 검색
|
|
|
|
|
var keys = dic_effect.Keys.ToList();
|
|
|
|
|
for (int i = 0; i < keys.Count; i++)
|
|
|
|
|
dic_effect[keys[i]].ForEach(f=>f.SetActive(false));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Show_Effect(string effectpath, Vector2 pos, float scale = 100f)
|
|
|
|
|
{
|
2026-01-16 03:05:10 +00:00
|
|
|
if (!effectpath.Contains("Effect/"))
|
|
|
|
|
effectpath = $"Effect/{effectpath}";
|
|
|
|
|
|
2026-01-15 05:28:45 +00:00
|
|
|
if (!dic_effect.ContainsKey(effectpath))
|
|
|
|
|
dic_effect.Add(effectpath, new List<GameObject>());
|
|
|
|
|
|
|
|
|
|
GameObject effect = null;
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < dic_effect[effectpath].Count; i++)
|
|
|
|
|
{
|
|
|
|
|
if (!dic_effect[effectpath][i].activeSelf)
|
|
|
|
|
{
|
|
|
|
|
effect = dic_effect[effectpath][i];
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (effect == null)
|
|
|
|
|
{
|
|
|
|
|
effect = DSUtil.Get_Clone(effectpath, tf_parent);
|
|
|
|
|
dic_effect[effectpath].Add(effect);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
effect.transform.position = pos;
|
|
|
|
|
effect.transform.localScale = Vector3.one * scale;
|
|
|
|
|
effect.gameObject.SetActive(true);
|
|
|
|
|
|
|
|
|
|
StartCoroutine(Co_Off(effect));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
IEnumerator Co_Off(GameObject effect)
|
|
|
|
|
{
|
|
|
|
|
yield return new WaitForSeconds(1f);
|
|
|
|
|
effect.SetActive(false);
|
|
|
|
|
}
|
|
|
|
|
}
|