From 85f0d13945f3aef5aef1b3c1b47c77cea0514c17 Mon Sep 17 00:00:00 2001 From: chenxin <chenxin6991@163.com> Date: Thu, 22 Oct 2020 16:06:50 +0800 Subject: [PATCH] Merge branch 'master' of http://172.16.1.52:8090/r/GemBattle into master --- Assets/Scripts/TowerDefense/UI/BulletUICtl.cs | 34 +++++++++++++++++++++++++++++++++- 1 files changed, 33 insertions(+), 1 deletions(-) diff --git a/Assets/Scripts/TowerDefense/UI/BulletUICtl.cs b/Assets/Scripts/TowerDefense/UI/BulletUICtl.cs index dd82f4a..0e7f4ff 100644 --- a/Assets/Scripts/TowerDefense/UI/BulletUICtl.cs +++ b/Assets/Scripts/TowerDefense/UI/BulletUICtl.cs @@ -1,4 +1,5 @@ using DG.Tweening; +using Protobuf; using System.Collections; using System.Collections.Generic; using UnityEngine; @@ -11,11 +12,42 @@ { public Image bulletScaleMask; public float fAdjValue; + /// <summary> + /// 最大子弹数目. + /// </summary> + public int maxBulletNum; + /// <summary> + /// 当前的子弹数目. + /// </summary> + protected int curBulletNum; // Start is called before the first frame update void Start() { - + resetToMaxBullet(); + } + + /// <summary> + /// 重设子弹数目到最大. + /// </summary> + public void resetToMaxBullet() + { + if (this.curBulletNum == maxBulletNum) return; + + this.curBulletNum = maxBulletNum; + this.updateBulletUI(curBulletNum, maxBulletNum); + } + + /// <summary> + /// 减少子弹,返回减少后的子弹数目。 + /// </summary> + /// <returns></returns> + public int decBullet() + { + if (this.curBulletNum <= 0) return 0; + this.curBulletNum--; + this.updateBulletUI(curBulletNum, maxBulletNum); + return curBulletNum; } /// <summary> -- Gitblit v1.9.1