Przeglądaj źródła

试修复游戏结束依然会刷怪问题

wgl 5 miesięcy temu
rodzic
commit
07576f386d

+ 5 - 0
ActionTowerDefense/Assets/Scripts/EnemyCreater.cs

@@ -147,6 +147,11 @@ public class EnemyCreater : MonoBehaviour
         _cancellationTokenSource?.Cancel();
         _cancellationTokenSource?.Dispose();
     }
+
+    void OnDisable()
+    {
+        StopAllCoroutines();
+    }
     public void OnGameTimeChange(float gameTime)
     {
         for (int i = idRange[0] + 1; i <= idRange[1]; i++)