wangguan
2020-11-12 a7956acb794f93fc01e16963efe1f38743b110f9
Assets/Scripts/TowerDefense/Towers/Tower.cs
@@ -1,4 +1,5 @@
using System;
using System.Collections;
using System;
using ActionGameFramework.Health;
using Core.Utilities;
using TowerDefense.Level;
@@ -157,13 +158,13 @@
            {
                if (attack && (this.curActionState != 2))
                {
                    currentTowerLevel.SetTowerMonsterMat(materialTowerAttackOppo);
                    currentTowerLevel.SetTowerMonsterMat(materialTowerAttackOppo, true);
                    this.curActionState = 2;
                }
                if ((!attack) && (this.curActionState != 1))
                {
                    currentTowerLevel.SetTowerMonsterMat(materialTowerWaitOppo);
                    currentTowerLevel.SetTowerMonsterMat(materialTowerWaitOppo, false);
                    this.curActionState = 1;
                }
            }
@@ -171,13 +172,13 @@
            {
                if (attack && (this.curActionState != 2))
                {
                    currentTowerLevel.SetTowerMonsterMat(materialTowerAttackSelf);
                    currentTowerLevel.SetTowerMonsterMat(materialTowerAttackSelf, true);
                    this.curActionState = 2;
                }
                if ((!attack) && (this.curActionState != 1))
                {
                    currentTowerLevel.SetTowerMonsterMat(materialTowerWaitSelf);
                    currentTowerLevel.SetTowerMonsterMat(materialTowerWaitSelf, false);
                    this.curActionState = 1;
                }
            }
@@ -192,10 +193,13 @@
        /// 播放充能状态特效.
        /// </summary>
        /// <param name="play"></param>
        public void PlayEnergyEffect(bool play)
        public void PlayEnergyEffect(bool play, bool isClose = true)
        {
            if (this.energyCtl)
            if (this.energyCtl && isClose)
                energyCtl.gameObject.SetActive(!play);
            else if(!isClose){
            }
            if (!opponentSide)
            {
@@ -223,9 +227,9 @@
                if (value)
                {
                    if (opponentSide)
                        currentTowerLevel.SetTowerMonsterMat(materialTowerWaitOppo);
                        currentTowerLevel.SetTowerMonsterMat(materialTowerWaitOppo, false);
                    else
                        currentTowerLevel.SetTowerMonsterMat(materialTowerWaitSelf);
                        currentTowerLevel.SetTowerMonsterMat(materialTowerWaitSelf, false);
                    // 处理Tower
                    this.setTowerState(false);
@@ -364,6 +368,42 @@
        }
        /// <summary>
        /// This function is called when the object becomes enabled and active.
        /// </summary>
        void OnEnable()
        {
            // if (bulletCtl != null)
            // {
            //     Debug.Log("打开了bulletCtl");
            //     bulletCtl.gameObject.SetActive(true);
            // }
            // if (energyCtl != null)
            // {
            //     Debug.Log("打开了energyCtl");
            //     energyCtl.gameObject.SetActive(true);
            // }
        }
        /// <summary>
        /// This function is called when the behaviour becomes disabled or inactive.
        /// </summary>
        void OnDisable()
        {
            if (bulletCtl != null)
            {
                bulletCtl.gameObject.SetActive(false);
            }
            if (energyCtl != null)
            {
                energyCtl.gameObject.SetActive(false);
            }
        }
        /// <summary>
        /// 初始化当前塔防的局内升级,lvl从1开始.
        /// </summary>
        /// <param name="lvl"></param>
@@ -376,7 +416,8 @@
                return;
            }
            // 设置攻击数据的加强,暂时是测试数据,后面需要读取表格数据处理:
            float damageAdd = (inSceneTowerLevel - 1) * this.INSCENE_TU_DAMAGE;
            float damageAdd = 0;
            // float damageAdd = (inSceneTowerLevel - 1) * this.INSCENE_TU_DAMAGE;
            for (int ti = 0; ti < this.levels.Length; ti++)
            {
                if (levels[ti].levelDamager)
@@ -510,10 +551,18 @@
            // 初始化当前的局内Tower等级数据
            this.initInSceneTowerLevel(SceneTowerLvl.getInSceneTowerLvl(this.towerName));
            StartCoroutine(ResetScale());
        }
        IEnumerator ResetScale()
        {
            yield return new WaitForSeconds(0.2f);
            if (gridPosition.y > 1)
            {
                currentTowerLevel.ResetScale();
            }else{
            }
            else
            {
                currentTowerLevel.NormalScale();
            }
        }