River Jiang
2020-10-22 6b3cb63ae5d3f3c4b196a236b08fc3a4e8dfd5c6
Assets/Scripts/TowerDefense/Towers/Tower.cs
@@ -75,6 +75,7 @@
        /// </summary>
        public ETowerFuntion eTowerFuntion = ETowerFuntion.NULL;
        public BulletUICtl bulletCtl = null;
        public EnergyUICtl energyCtl = null;
        /// <summary>
        /// The tower levels associated with this tower
@@ -196,7 +197,6 @@
                    // 处理Tower
                    this.setTowerState(false);
                    if (opponentSide)
                    {
                        OpponentMgr.instance.SetTowerAttID(gridPosition.x, attributeId, this.currentLevel);
@@ -215,27 +215,49 @@
                        }
                    }
                    //
                    // 根据是否是子弹塔防来决定是否显示相应的界面
                    BulletUICtl buc = this.placementArea.GetBulletUICtl(gridPosition.x);
                    if ( (this.eTowerFuntion == ETowerFuntion.BULLET) && (buc != null ) )
                    {
                        // 设置数据
                        buc.gameObject.SetActive(true);
                        this.bulletCtl = buc;
                        buc.resetToMaxBullet();
                    }
                    else
                    {
                        // 清空数据
                        buc.gameObject.SetActive(false);
                        this.bulletCtl = null;
                    }
                    // 处理塔位边上的界面.
                    OnTowerUICtrl();
                }
            }
        }
        protected void OnTowerUICtrl()
        {
            //
            // 根据是否是子弹塔防来决定是否显示相应的界面
            BulletUICtl buc = this.placementArea.GetBulletUICtl(gridPosition.x);
            if ((this.eTowerFuntion == ETowerFuntion.BULLET) && (buc != null))
            {
                // 设置数据
                buc.gameObject.SetActive(true);
                this.bulletCtl = buc;
                buc.resetToMaxBullet();
            }
            else
            {
                // 清空数据
                buc.gameObject.SetActive(false);
                this.bulletCtl = null;
            }
            // 根据是否是能量充能来决定是否显示相应的界面.
            EnergyUICtl euc = placementArea.GetEnergyUICtl(gridPosition.x);
            if( (eTowerFuntion == ETowerFuntion.ENERGY) &&(euc != null ))
            {
                // 设置数据
                euc.gameObject.SetActive(true);
                this.energyCtl = euc;
                euc.SetEnergyProgress(0);
            }
            else
            {
                // 清空数据
                euc.gameObject.SetActive(false);
                this.energyCtl = null;
            }
        }
        /// <summary>
        /// 初始化当前塔防的局内升级,lvl从1开始.
        /// </summary>