From d185e655cd926e45ed7f7ce3f59af7dc23b4c372 Mon Sep 17 00:00:00 2001
From: chenxin <chenxin6991@163.com>
Date: Tue, 22 Dec 2020 09:53:07 +0800
Subject: [PATCH] Merge branch 'master' of http://47.95.218.140:8090/r/GemBattle into master

---
 Assets/Scripts/TowerDefense/UI/HUD/SelectBuffIcon.cs |   38 ++++++++++++++++++++++++++++++++++----
 1 files changed, 34 insertions(+), 4 deletions(-)

diff --git a/Assets/Scripts/TowerDefense/UI/HUD/SelectBuffIcon.cs b/Assets/Scripts/TowerDefense/UI/HUD/SelectBuffIcon.cs
index a11cae1..7677345 100644
--- a/Assets/Scripts/TowerDefense/UI/HUD/SelectBuffIcon.cs
+++ b/Assets/Scripts/TowerDefense/UI/HUD/SelectBuffIcon.cs
@@ -53,9 +53,11 @@
         private string qualityPath = "UI/Endless/BuffQuality/";
         public ParticleSystem myPS;//播放粒子特效
         GameObject psParent;
+
+        public BuffFly buffFly;//确定后的飞动脚本
         private void Start()
         {
-            if (psParent == null)
+            if (psParent == null && myPS != null)
             {
                 psParent = myPS.transform.parent.gameObject;
             }
@@ -63,10 +65,32 @@
 
         public void OnClick()
         {
-            AudioSourceManager.Ins.Play(AudioEnum.ChooseBuff);
+            //判断是否是金钱
+            if (isGold)
+            {
+                AudioSourceManager.Ins.Play(AudioEnum.Gold);
+            }
+            else
+            {
+                AudioSourceManager.Ins.Play(AudioEnum.UI);
+            }
 
             if (OnSelectBuffCompleted != null)
                 OnSelectBuffCompleted(Index);
+        }
+
+        public void Fly()
+        {
+            if (buffFly != null)
+            {
+                buffFly.SetIcon(Icon.sprite);
+                buffFly.SetQuality(QualityImage.sprite);
+                buffFly.SetName(Name.text);
+                buffFly.SetEffect(Effect.text);
+                buffFly.SetRare(Name.color);
+                buffFly.Fly();
+            }
+
         }
 
         public void SetIcon(int resId)
@@ -106,6 +130,12 @@
             Name.color = EndlessBuffData.GetColorByRare(rare);
         }
 
+        bool isGold;//是否是金币BUFF
+        public void SetIsGold(bool isGold)
+        {
+            this.isGold = isGold;
+        }
+
 
         /// <summary>
         /// 设置选中状态,做个缓动播放粒子特效
@@ -122,12 +152,12 @@
             {
                 DOTween.To(() => transform.localScale, (v) => transform.localScale = v, new Vector3(1f, 1f, 1f), 0.15f);
                 if (!psParent.activeSelf) psParent.SetActive(true);
-                myPS.Play();
+                myPS?.Play();
             }
             else
             {
                 DOTween.To(() => transform.localScale, (v) => transform.localScale = v, new Vector3(0.87f, 0.87f, 0.87f), 0.15f);
-                myPS.Stop();
+                myPS?.Stop();
                 if (psParent.activeSelf) psParent.SetActive(false);
 
             }

--
Gitblit v1.9.1