From cec8b67d82c2c2c1662d55c818c4a46bcc0487db Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期一, 25 八月 2025 17:36:02 +0800
Subject: [PATCH] 125 【战斗】战斗系统 战斗技能

---
 Main/Component/UI/Effect/BattleEffectPlayer.cs |   32 ++++++++++++++++----------------
 1 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/Main/Component/UI/Effect/BattleEffectPlayer.cs b/Main/Component/UI/Effect/BattleEffectPlayer.cs
index 5dc1a4b..853ecf8 100644
--- a/Main/Component/UI/Effect/BattleEffectPlayer.cs
+++ b/Main/Component/UI/Effect/BattleEffectPlayer.cs
@@ -184,6 +184,12 @@
             this.gameObject.SetActive(true);
         }
 
+        if (effectConfig.autoDestroy != 0)
+        {
+            GameObject.Destroy(gameObject, effectConfig.destroyDelay);
+        }
+
+
         PlayEffect();
         
 
@@ -396,25 +402,19 @@
 
 
     //  鍒涘缓鍚庣殑鐗规晥浼氳嚜鍔ㄩ殣钘� 闇�瑕佹墜鍔ㄨ皟鐢≒lay鎵嶈兘鎾斁
-    public static BattleEffectPlayer Create(int effectId, Transform parent, bool createNewChild = false)
+    public static BattleEffectPlayer Create(int effectId, Transform parent)
     {
         // 鐩存帴鍒涘缓鐗规晥鎾斁鍣紝涓嶄娇鐢ㄥ璞℃睜
-        BattleEffectPlayer BattleEffectPlayer = null;
+        BattleEffectPlayer battleEffectPlayer = null;
 
-        if (createNewChild)
-        {
-            GameObject newGo = new GameObject("BattleEffectPlayer_" + effectId);
-            newGo.transform.SetParent(parent, false);
-            BattleEffectPlayer = newGo.AddComponent<BattleEffectPlayer>();
-        }
-        else
-        {
-            BattleEffectPlayer = parent.AddMissingComponent<BattleEffectPlayer>();
-        }
-
-        BattleEffectPlayer.effectId = effectId;
-        BattleEffectPlayer.SetActive(true);
-        return BattleEffectPlayer;
+        GameObject newGo = new GameObject("BattleEffectPlayer_" + effectId);
+        newGo.transform.SetParent(parent, false);
+        newGo.AddMissingComponent<RectTransform>();
+        battleEffectPlayer = newGo.AddComponent<BattleEffectPlayer>();
+        
+        battleEffectPlayer.effectId = effectId;
+        battleEffectPlayer.SetActive(true);
+        return battleEffectPlayer;
     }
 
     /// <summary>

--
Gitblit v1.8.0