From 6b3cb63ae5d3f3c4b196a236b08fc3a4e8dfd5c6 Mon Sep 17 00:00:00 2001
From: River Jiang <546213258@qq.com>
Date: Thu, 22 Oct 2020 20:09:26 +0800
Subject: [PATCH] 火塔加入充能条

---
 Assets/Scripts/TowerDefense/UI/EnergyUICtl.cs |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/Assets/Scripts/TowerDefense/UI/EnergyUICtl.cs b/Assets/Scripts/TowerDefense/UI/EnergyUICtl.cs
index 2f5ab5c..f8a25c7 100644
--- a/Assets/Scripts/TowerDefense/UI/EnergyUICtl.cs
+++ b/Assets/Scripts/TowerDefense/UI/EnergyUICtl.cs
@@ -12,9 +12,9 @@
     public Image energyScaleMask;
 
     /// <summary>
-    /// 当前的能量条进度.
+    /// 当前的能量条进度.10份进度.
     /// </summary>
-    protected float currentProgress;
+    protected int currentProgress;
 
     // Start is called before the first frame update
     void Start()
@@ -27,9 +27,11 @@
     /// 显示并更新能量条进度.
     /// </summary>
     /// <param name="pro"></param>
-    public void SetEnergyProgress(float pro)
+    public void SetEnergyProgress(int pro)
     {
-        energyScaleMask.rectTransform.DOScaleY( pro, 0.3f );
+        if (pro == currentProgress) return;
+
+        energyScaleMask.rectTransform.DOScaleY( pro / 10.0f, 0.3f );
         currentProgress = pro;
     }
 

--
Gitblit v1.9.1