summaryrefslogtreecommitdiff
path: root/Assets/Scripts/Effects/EffectsManager.cs
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2022-03-10 14:07:40 +0800
committerchai <chaifix@163.com>2022-03-10 14:07:40 +0800
commit22891bf59032ba88262824255a706d652031384b (patch)
tree7595439ba9966c9402d37e37cee5e8cf098757d5 /Assets/Scripts/Effects/EffectsManager.cs
parent8b04ea73e540067f83870b61d89db4868fea5e8a (diff)
* move folder
Diffstat (limited to 'Assets/Scripts/Effects/EffectsManager.cs')
-rw-r--r--Assets/Scripts/Effects/EffectsManager.cs73
1 files changed, 0 insertions, 73 deletions
diff --git a/Assets/Scripts/Effects/EffectsManager.cs b/Assets/Scripts/Effects/EffectsManager.cs
deleted file mode 100644
index f62b0bdb..00000000
--- a/Assets/Scripts/Effects/EffectsManager.cs
+++ /dev/null
@@ -1,73 +0,0 @@
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-using System;
-
-public class EffectsManager : MonoBehaviour
-{
- public static EffectsManager Instance;
-
- public Effect[] EffectTemplates;
-
- public Transform Root_Pool;
-
- List<Effect> m_Pool = new List<Effect>();
-
- private void Awake()
- {
- Instance = this;
- }
-
- Effect GetEffectTemplate(string name)
- {
- foreach(var effect in EffectTemplates)
- {
- if(effect != null && effect.Name == name)
- {
- return effect;
- }
- }
- return null;
- }
-
- Effect RecycleEffect(string name)
- {
- foreach(var effect in m_Pool)
- {
- if (effect != null && effect.Name == name)
- {
- return effect;
- }
- }
- return null;
- }
-
- public void PlayEffect(string name, Vector3 position, Vector3 rotation, Vector3 scale)
- {
- Effect effect = RecycleEffect(name);
- if(effect == null)
- {
- Effect temp = GetEffectTemplate(name);
- effect = UnityEngine.Object.Instantiate(temp);
- }
- else
- {
- m_Pool.Remove(effect);
- }
-
- effect.transform.position = position;
- effect.transform.rotation = Quaternion.Euler(rotation);
- effect.transform.localScale = scale;
- effect.transform.SetParent(this.transform);
- effect.gameObject.SetActive(true);
- }
-
- // 回收特效
- public void CycleEffect(Effect effect)
- {
- effect.gameObject.SetActive(false);
- effect.transform.SetParent(Root_Pool);
- m_Pool.Add(effect);
- }
-
-}