chenxin
2020-10-26 6f16dfb8bcebe67aeb95ded0d8b644af4932e690
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
@@ -139,7 +140,7 @@
        {
            if (!materialTowerAttackSelf) return;
            if( opponentSide)
            if (opponentSide)
            {
                if (attack && (this.curActionState != 2))
                {
@@ -149,7 +150,7 @@
                if ((!attack) && (this.curActionState != 1))
                {
                    currentTowerLevel.SetTowerMonsterMat( materialTowerWaitOppo );
                    currentTowerLevel.SetTowerMonsterMat(materialTowerWaitOppo);
                    this.curActionState = 1;
                }
            }
@@ -196,7 +197,6 @@
                    // 处理Tower
                    this.setTowerState(false);
                    if (opponentSide)
                    {
                        OpponentMgr.instance.SetTowerAttID(gridPosition.x, attributeId, this.currentLevel);
@@ -215,27 +215,51 @@
                        }
                    }
                    //
                    // 根据是否是子弹塔防来决定是否显示相应的界面
                    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, gridPosition.y);
            if (buc == null) return;
            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, gridPosition.y);
            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>