From 0cf6de61440ba15668f66da5a2262132cb5c5ae5 Mon Sep 17 00:00:00 2001
From: wangguan <wangguan@kt007.com>
Date: Mon, 02 Nov 2020 20:50:12 +0800
Subject: [PATCH] 宝石飞动效

---
 Assets/Scripts/TowerDefense/Level/EndlessDropManager.cs |   33 +++++++++++++++++++++++++++++----
 1 files changed, 29 insertions(+), 4 deletions(-)

diff --git a/Assets/Scripts/TowerDefense/Level/EndlessDropManager.cs b/Assets/Scripts/TowerDefense/Level/EndlessDropManager.cs
index 5715502..01c55c5 100644
--- a/Assets/Scripts/TowerDefense/Level/EndlessDropManager.cs
+++ b/Assets/Scripts/TowerDefense/Level/EndlessDropManager.cs
@@ -54,6 +54,7 @@
         {
             AllDropList = new List<EndlessDrop>();
             DropObjDic = new Dictionary<int, GameObject>();
+            allIconLis = new List<FlyImage>();
         }
 
         // Update is called once per frame
@@ -67,9 +68,12 @@
 
                 if (AllDropList[i].ElapsedTime >= AllDropList[i].AutoPickupTime)
                 {
-                    AllDropList[i].IsPickupCompleted = true;
-                    SafelyCallObtainDrop(AllDropList[i]);
-                    RemoveDrop(AllDropList[i].Id);
+                    EndlessDropReward dropReward = DropObjDic[AllDropList[i].Id].GetComponent<EndlessDropReward>();
+                    dropReward?.OnClick();
+
+                    //AllDropList[i].IsPickupCompleted = true;
+                    //SafelyCallObtainDrop(AllDropList[i]);
+                    //RemoveDrop(AllDropList[i].Id);
                 }
             }
         }
@@ -139,7 +143,7 @@
             dropReward.DropData = drop;
             dropReward.SetIcon();
 
-            GameObject mainUI = GameObject.Find("MainUI");
+            GameObject mainUI = GameObject.Find("BottomUI");
 
             Transform mainUITransform = mainUI.transform;
             obj.transform.SetParent(mainUITransform, false);
@@ -169,6 +173,27 @@
             DropObjDic.Add(drop.Id, obj);
         }
 
+
+        List<FlyImage> allIconLis;
+        public GameObject drapIcon;
+
+        public FlyImage CreateIcon(Transform ts)
+        {
+            for (int i = 0; i < allIconLis.Count; i++)
+            {
+                if (!allIconLis[i].gameObject.activeSelf)
+                {
+                    allIconLis[i].gameObject.SetActive(true);
+                    return allIconLis[i];
+                }
+            }
+
+            GameObject obj = Instantiate(drapIcon, ts);
+            FlyImage fly = obj.GetComponent<FlyImage>();
+            allIconLis.Add(fly);
+            return fly;
+
+        }
         /// <summary>
         /// 调用掉落获得事件
         /// </summary>

--
Gitblit v1.9.1