River Jiang
2020-10-28 00451158ba904571b1c6c755f34292dc76e25d80
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,13 @@
        {
            get; set;
        }
        public int uiProOffset
        {
            get { return this.progressOffset; }
            set { this.progressOffset = value; }
        }
        /// <summary>
        /// Gets whether the tower can level up anymore
@@ -140,7 +151,7 @@
        {
            if (!materialTowerAttackSelf) return;
            if( opponentSide)
            if (opponentSide)
            {
                if (attack && (this.curActionState != 2))
                {
@@ -150,7 +161,7 @@
                if ((!attack) && (this.curActionState != 1))
                {
                    currentTowerLevel.SetTowerMonsterMat( materialTowerWaitOppo );
                    currentTowerLevel.SetTowerMonsterMat(materialTowerWaitOppo);
                    this.curActionState = 1;
                }
            }
@@ -174,6 +185,39 @@
        /// 是否是对手塔防
        /// </summary>
        public bool opponentSide { get; set; }
        /// <summary>
        /// 播放充能状态特效.
        /// </summary>
        /// <param name="play"></param>
        public void PlayEnergyEffect( bool play)
        {
            if (this.energyCtl)
                energyCtl.gameObject.SetActive(!play);
            if( play)
            {
                if( !opponentSide)
                {
                    ((TowerPlacementGrid)GameUI.instance.selfTowerPlaceArea).PlayEnergyEffect(gridPosition.x, true);
                }
                else
                {
                    ((TowerPlacementGrid)OpponentMgr.instance.m_CurrentArea).PlayEnergyEffect(gridPosition.x, true);
                }
            }
            else
            {
                if ( !opponentSide)
                {
                    ((TowerPlacementGrid)GameUI.instance.selfTowerPlaceArea).PlayEnergyEffect(gridPosition.x, false);
                }
                else
                {
                    ((TowerPlacementGrid)OpponentMgr.instance.m_CurrentArea).PlayEnergyEffect(gridPosition.x, false);
                }
            }
        }
        /// <summary>
        /// 当前是否处于攻击模式
@@ -222,11 +266,83 @@
            }
        }
        /// <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()
        {
            //
            // 根据是否是子弹塔防来决定是否显示相应的界面
            BulletUICtl buc = this.placementArea.GetBulletUICtl(gridPosition.x);
            BulletUICtl buc = this.placementArea.GetBulletUICtl(gridPosition.x, gridPosition.y);
            if (buc == null) return;
            if ((this.eTowerFuntion == ETowerFuntion.BULLET) && (buc != null))
            {
                // 设置数据
@@ -242,8 +358,8 @@
            }
            // 根据是否是能量充能来决定是否显示相应的界面.
            EnergyUICtl euc = placementArea.GetEnergyUICtl(gridPosition.x);
            if( (eTowerFuntion == ETowerFuntion.ENERGY) &&(euc != null ))
            EnergyUICtl euc = placementArea.GetEnergyUICtl(gridPosition.x, gridPosition.y);
            if ((eTowerFuntion == ETowerFuntion.ENERGY) && (euc != null))
            {
                // 设置数据
                euc.gameObject.SetActive(true);