From 1f5eda1c9d22a3676298751c7282a5874f13bed0 Mon Sep 17 00:00:00 2001 From: River Jiang <546213258@qq.com> Date: Tue, 27 Oct 2020 17:26:52 +0800 Subject: [PATCH] 加入充能、子弹进度条保持进度的功能 --- Assets/Scripts/TowerDefense/Towers/Tower.cs | 77 ++++++++++++++++++++++++++++++++++++++ 1 files changed, 77 insertions(+), 0 deletions(-) diff --git a/Assets/Scripts/TowerDefense/Towers/Tower.cs b/Assets/Scripts/TowerDefense/Towers/Tower.cs index b5a661a..1b0fae9 100644 --- a/Assets/Scripts/TowerDefense/Towers/Tower.cs +++ b/Assets/Scripts/TowerDefense/Towers/Tower.cs @@ -119,6 +119,10 @@ /// </summary> public float attackRise { get; set; } + /// <summary> + /// 用于界面部分的数据位移 + /// </summary> + protected int progressOffset = 0; /// <summary> /// 塔防数据的局内升级 @@ -127,6 +131,12 @@ { get; set; } + + public int uiProOffset + { + get { return this.progressOffset; } + } + /// <summary> /// Gets whether the tower can level up anymore @@ -223,6 +233,73 @@ } /// <summary> + /// 去掉当前Tower对应的界面数据. + /// </summary> + public void DisableTowerUICtrl() + { + // 根据是否是子弹塔防来决定是否显示相应的界面 + BulletUICtl buc = this.placementArea.GetBulletUICtl(gridPosition.x, gridPosition.y); + + if ((this.eTowerFuntion == ETowerFuntion.BULLET) && (buc != null)) + { + buc.gameObject.SetActive(false); + this.bulletCtl = null; + } + + EnergyUICtl euc = placementArea.GetEnergyUICtl(gridPosition.x, gridPosition.y); + if ((eTowerFuntion == ETowerFuntion.ENERGY) && (euc != null)) + { + // 设置数据 + euc.gameObject.SetActive(false); + this.energyCtl = null; + } + + return; + } + + public int GetTowerUICtrlProgress() + { + // 根据是否是子弹塔防来决定是否显示相应的界面 + BulletUICtl buc = this.placementArea.GetBulletUICtl(gridPosition.x, gridPosition.y); + + if ((this.eTowerFuntion == ETowerFuntion.BULLET) && (buc != null)) + return buc.GetCtlProgress(); + + EnergyUICtl euc = placementArea.GetEnergyUICtl(gridPosition.x, gridPosition.y); + if ((eTowerFuntion == ETowerFuntion.ENERGY) && (euc != null)) + return euc.GetCtlProgress(); + + return 0; + } + + public void SetTowerUICtlProcess( int pro) + { + // 根据是否是子弹塔防来决定是否显示相应的界面 + BulletUICtl buc = this.placementArea.GetBulletUICtl(gridPosition.x, gridPosition.y); + + if ((this.eTowerFuntion == ETowerFuntion.BULLET) && (buc != null)) + { + buc.SetCtlProcess(pro); + progressOffset = pro; + } + + EnergyUICtl euc = placementArea.GetEnergyUICtl(gridPosition.x, gridPosition.y); + if ((eTowerFuntion == ETowerFuntion.ENERGY) && (euc != null)) + { + euc.SetCtlProcess(pro); + progressOffset = pro; + if (progressOffset == 10) + progressOffset = 0; + } + + + + return; + } + + + + /// <summary> /// 充能技能相关的代码开关。包括子弹充能和时间充能 /// </summary> protected void OnTowerUICtrl() -- Gitblit v1.9.1