River Jiang
2020-10-21 16072ec5c78cf2f183ef5cbdddeb34416225a9ea
Assets/Scripts/TowerDefense/Towers/Tower.cs
@@ -58,9 +58,21 @@
        public Material materialMonsterOppo;
        /// <summary>
        /// 当前塔防对应的攻击和等待Mat.
        /// </summary>
        public Material materialTowerAttackSelf;
        public Material materialTowerWaitSelf;
        /// <summary>
        /// 0 空状态  1 等待状态  2 攻击状态.
        /// </summary>
        protected int curActionState = 0;
        /// <summary>
        /// 塔防对应的充能状态.
        /// </summary>
        public ETowerFuntion eTowerFuntion = ETowerFuntion.NULL;
        public BulletUICtl bulletCtl = null;
        /// <summary>
        /// The tower levels associated with this tower
@@ -120,6 +132,23 @@
            get { return currentLevel == levels.Length - 1; }
        }
        public void setTowerState(bool attack)
        {
            if (!materialTowerAttackSelf) return;
            if (attack && (this.curActionState != 2))
            {
                currentTowerLevel.SetTowerMonsterMat(materialTowerAttackSelf);
                this.curActionState = 2;
            }
            if ((!attack) && (this.curActionState != 1))
            {
                currentTowerLevel.SetTowerMonsterMat(materialTowerWaitSelf);
                this.curActionState = 1;
            }
        }
        /// <summary>
        /// 是否是对手塔防
        /// </summary>
@@ -142,7 +171,11 @@
                    if (opponentSide)
                        currentTowerLevel.SetTowerMonsterMat(materialMonsterOppo);
                    else
                    {
                        currentTowerLevel.SetTowerMonsterMat(materialMonsterSelf);
                        this.setTowerState(false);
                    }
                    if (opponentSide)
                    {
@@ -163,12 +196,16 @@
                    }
                    // 
                    // 根据是否是子弹塔防来决定是否显示相应的界面.WORK START: 处理出来下一步的子弹减少和对应的充子弹时间.
                    // 根据是否是子弹塔防来决定是否显示相应的界面
                    if (this.eTowerFuntion == ETowerFuntion.BULLET)
                    {
                        BulletUICtl buc = this.placementArea.GetBulletUICtl(gridPosition.x);
                        if (buc)
                        {
                            buc.gameObject.SetActive(true);
                            this.bulletCtl = buc;
                            buc.resetToMaxBullet();
                        }
                    }
                }