chenxin
2020-10-22 e28fd5cc81c68db8efcab33ea526643aae5e2c19
Assets/Scripts/TowerDefense/Towers/Tower.cs
@@ -62,6 +62,8 @@
        /// </summary>
        public Material materialTowerAttackSelf;
        public Material materialTowerWaitSelf;
        public Material materialTowerAttackOppo;
        public Material materialTowerWaitOppo;
        /// <summary>
        /// 0 空状态  1 等待状态  2 攻击状态.
@@ -116,6 +118,7 @@
        /// </summary>
        public float attackRise { get; set; }
        /// <summary>
        /// 塔防数据的局内升级
        /// </summary>
@@ -136,16 +139,33 @@
        {
            if (!materialTowerAttackSelf) return;
            if (attack && (this.curActionState != 2))
            if( opponentSide)
            {
                currentTowerLevel.SetTowerMonsterMat(materialTowerAttackSelf);
                this.curActionState = 2;
            }
                if (attack && (this.curActionState != 2))
                {
                    currentTowerLevel.SetTowerMonsterMat(materialTowerAttackOppo);
                    this.curActionState = 2;
                }
            if ((!attack) && (this.curActionState != 1))
                if ((!attack) && (this.curActionState != 1))
                {
                    currentTowerLevel.SetTowerMonsterMat( materialTowerWaitOppo );
                    this.curActionState = 1;
                }
            }
            else
            {
                currentTowerLevel.SetTowerMonsterMat(materialTowerWaitSelf);
                this.curActionState = 1;
                if (attack && (this.curActionState != 2))
                {
                    currentTowerLevel.SetTowerMonsterMat(materialTowerAttackSelf);
                    this.curActionState = 2;
                }
                if ((!attack) && (this.curActionState != 1))
                {
                    currentTowerLevel.SetTowerMonsterMat(materialTowerWaitSelf);
                    this.curActionState = 1;
                }
            }
        }
@@ -171,11 +191,11 @@
                    if (opponentSide)
                        currentTowerLevel.SetTowerMonsterMat(materialMonsterOppo);
                    else
                    {
                        currentTowerLevel.SetTowerMonsterMat(materialMonsterSelf);
                        this.setTowerState(false);
                    }
                    // 处理Tower
                    this.setTowerState(false);
                    if (opponentSide)
                    {
@@ -197,15 +217,19 @@
                    // 
                    // 根据是否是子弹塔防来决定是否显示相应的界面
                    if (this.eTowerFuntion == ETowerFuntion.BULLET)
                    BulletUICtl buc = this.placementArea.GetBulletUICtl(gridPosition.x);
                    if ( (this.eTowerFuntion == ETowerFuntion.BULLET) && (buc != null ) )
                    {
                        BulletUICtl buc = this.placementArea.GetBulletUICtl(gridPosition.x);
                        if (buc)
                        {
                            buc.gameObject.SetActive(true);
                            this.bulletCtl = buc;
                            buc.resetToMaxBullet();
                        }
                        // 设置数据
                        buc.gameObject.SetActive(true);
                        this.bulletCtl = buc;
                        buc.resetToMaxBullet();
                    }
                    else
                    {
                        // 清空数据
                        buc.gameObject.SetActive(false);
                        this.bulletCtl = null;
                    }
                }