chenxin
2020-11-24 0083101f1ac0bfae659d18ec7b8ad10e649d8db6
放置丢塔问题
5 files modified
55 ■■■■■ changed files
Assets/Scripts/TowerDefense/Affectors/AttackAffector.cs 7 ●●●● patch | view | raw | blame | history
Assets/Scripts/TowerDefense/Level/EndlessBuff/EndlessBuffManager.cs 22 ●●●●● patch | view | raw | blame | history
Assets/Scripts/TowerDefense/Towers/Projectiles/BallisticAttack.cs 8 ●●●● patch | view | raw | blame | history
Assets/Scripts/TowerDefense/UI/HUD/EndlessGameUI.cs 16 ●●●● patch | view | raw | blame | history
Assets/StreamingAssets/Table/endless_buff.json 2 ●●● patch | view | raw | blame | history
Assets/Scripts/TowerDefense/Affectors/AttackAffector.cs
@@ -153,8 +153,10 @@
            get
            {
                FireRateAdd fireRateAdd = (FireRateAdd)EndlessBuffManager.instance.GetBuffInstanceByType(EndlessBuffEffectType.FireRateAdd);
                float rateAdd = fireRateAdd.GetFireSpeedAdd(towerPtr.attributeId);
                float rateAdd = 0;
                if (fireRateAdd != null)
                    rateAdd = fireRateAdd.GetFireSpeedAdd(towerPtr.attributeId);
                return rateAdd > 1 ? rateAdd : fireSpeed;
            }
        }
@@ -473,7 +475,8 @@
        public float GetFireDuration()
        {
            DecreaseTowerAttackCD endlessBuff = (DecreaseTowerAttackCD)EndlessBuffManager.instance.GetBuffInstanceByType(EndlessBuffEffectType.DecreaseTowerAttackCD);
            return endlessBuff.GetDecreaseCD(towerPtr.attributeId, 1 / projectileFireRate);
            return endlessBuff != null ? endlessBuff.GetDecreaseCD(towerPtr.attributeId, 1 / projectileFireRate) : 1 / projectileFireRate;
        }
        /// <summary>
Assets/Scripts/TowerDefense/Level/EndlessBuff/EndlessBuffManager.cs
@@ -54,14 +54,17 @@
            BuffList.Add(buff);
            EndlessBuff endlessBuff = GetBuffInstanceByType((EndlessBuffEffectType)buff.Config.buff_effect[0]);
            endlessBuff.BuffList.Add(buff);
            endlessBuff.Handle();
            // 如果是一次性生效的buff,直接移除掉
            if (buff.LifeCycleType == EndlessBuffLifeCycleType.Once)
            if (endlessBuff != null)
            {
                endlessBuff.BuffList.Remove(buff);
                RemoveBuff(buff);
                endlessBuff.BuffList.Add(buff);
                endlessBuff.Handle();
                // 如果是一次性生效的buff,直接移除掉
                if (buff.LifeCycleType == EndlessBuffLifeCycleType.Once)
                {
                    endlessBuff.BuffList.Remove(buff);
                    RemoveBuff(buff);
                }
            }
        }
@@ -73,7 +76,7 @@
        {
            BuffList.Remove(buff);
            EndlessBuff endlessBuff = GetBuffInstanceByType((EndlessBuffEffectType)buff.Config.buff_effect[0]);
            endlessBuff.LoseEffect();
            endlessBuff?.LoseEffect();
        }
        /// <summary>
@@ -148,6 +151,9 @@
        /// <returns></returns>
        public EndlessBuff GetBuffInstanceByType(EndlessBuffEffectType type)
        {
            int tmp = (int)type - 1;
            if ((int)type - 1 >= instanceList.Count) return null;
            return instanceList[(int)type - 1];
        }
    }
Assets/Scripts/TowerDefense/Towers/Projectiles/BallisticAttack.cs
@@ -96,6 +96,9 @@
        private bool IsCrit()
        {
            CritProbabilityAdd critProbabilityAdd = (CritProbabilityAdd)EndlessBuffManager.instance.GetBuffInstanceByType(EndlessBuffEffectType.CritProbabilityAdd);
            if (critProbabilityAdd == null) return false;
            float crit = critProbabilityAdd.GetCrit(TowerPtr.attributeId);
            float random = UnityEngine.Random.Range(0, 1f);
@@ -109,7 +112,8 @@
        private float GetCritDamageRate()
        {
            CritDamageAdd critDamageAdd = (CritDamageAdd)EndlessBuffManager.instance.GetBuffInstanceByType(EndlessBuffEffectType.CritDamageAdd);
            return critDamageAdd.GetCritDamageRate(TowerPtr.attributeId);
            return critDamageAdd == null ? 0 : critDamageAdd.GetCritDamageRate(TowerPtr.attributeId);
        }
        /// <summary>
@@ -200,7 +204,7 @@
            {
                case 2:  // 减速.
                    SlowDown slowDown = (SlowDown)EndlessBuffManager.instance.GetBuffInstanceByType(EndlessBuffEffectType.SlowDown);
                    enemy.addSpeedSlowRate(0.15f + slowDown.GetSlowDownAdd(TowerPtr.attributeId));
                    enemy.addSpeedSlowRate(0.15f + (slowDown != null ? slowDown.GetSlowDownAdd(TowerPtr.attributeId) : 0));
                    enemy.SetTargetableMatColor(Color.blue);
                    break;
                case 3:  // 中毒
Assets/Scripts/TowerDefense/UI/HUD/EndlessGameUI.cs
@@ -1363,9 +1363,7 @@
                return false;
            }
            BuyTower(pointer, force, zeroCost);
            return true;
            return BuyTower(pointer, force, zeroCost);
        }
        /// <summary>
@@ -1573,9 +1571,9 @@
        /// Throws exception when not in a build mode or when tower is not a valid position
        /// </exception>
        /// </summary>
        public void BuyTower(UIPointer pointer, bool force = false, bool zeroCost = false)
        public bool BuyTower(UIPointer pointer, bool force = false, bool zeroCost = false)
        {
            if (!isBuilding) return;
            if (!isBuilding) return false;
            // 判断是否格子上重复放置塔防
            if (!m_CurrentTower || !IsGhostAtValidPosition())
@@ -1607,11 +1605,11 @@
                    if (!pointer.raycast.HasValue || pointer.raycast.Value.collider == null)
                    {
                        CancelGhostPlacement();
                        return;
                        return false;
                    }
                    PlaceGhost(pointer);
                }
                return;
                return true;
            }
            // 这是判断是否超出了格子
@@ -1619,7 +1617,7 @@
            if (!pointer.raycast.HasValue || pointer.raycast.Value.collider == null)
            {
                CancelGhostPlacement();
                return;
                return false;
            }
            int cost = m_CurrentTower.controller.purchaseCost;
@@ -1630,6 +1628,8 @@
            {
                PlaceGhost(pointer);
            }
            return true;
        }
        /// <summary>
Assets/StreamingAssets/Table/endless_buff.json
@@ -1 +1 @@
[[1,"低级火灵之力",[2,1],[1,10,0],-1,"增加全体火精灵10%攻击力",0,"3",10001,1,"0"],[2,"低级水灵之力",[2,2],[1,10,0],-1,"增加全体水精灵10%攻击力",0,"3",10002,1,"0"],[3,"低级木灵之力",[2,3],[1,10,0],-1,"增加全体木精灵10%攻击力",0,"3",10003,1,"0"],[4,"火灵之力",[2,1],[1,20,0],-1,"增加全体火精灵20%攻击力","4","7",10001,2,"0"],[5,"水灵之力",[2,2],[1,20,0],-1,"增加全体水精灵20%攻击力","4","7",10002,2,"0"],[6,"木灵之力",[2,3],[1,20,0],-1,"增加全体木精灵20%攻击力","4","7",10003,2,"0"],[7,"高级火灵之力",[2,1],[1,30,0],-1,"增加全体火精灵30%攻击力","8","10",10001,3,"0"],[8,"高级水灵之力",[2,2],[1,30,0],-1,"增加全体水精灵30%攻击力","8","10",10002,3,"0"],[9,"高级木灵之力",[2,3],[1,30,0],-1,"增加全体木精灵30%攻击力","8","10",10003,3,"0"],[10,"特级火灵之力",[2,1],[1,40,0],-1,"增加全体火精灵40%攻击力","11","17",10001,3,"0"],[11,"特级水灵之力",[2,2],[1,40,0],-1,"增加全体水精灵40%攻击力","11","17",10002,3,"0"],[12,"特级木灵之力",[2,3],[1,40,0],-1,"增加全体木精灵40%攻击力","11","17",10003,3,"0"],[13,"精灵之力",[1,0],[1,50,0],2,"2波增加全体精灵50%攻击力","99",99,10004,2,1],[14,"狂暴之力",[1,0],[1,65,0],2,"2波内增加全体精灵65%攻击力","99",99,10005,3,1],[15,"飞来横财",[0],[2,300,0],0,"增加300金币","0","4",10007,1,"0"],[16,"中大奖!",[0],[2,800,0],0,"增加800金币","5","99",10007,3,"0"],[17,"精灵魔盒",[0],[3,3,300],0,"随机获得一个3级精灵",99,99,10006,2,1],[18,"超级精灵魔盒",[0],[3,4,500],0,"随机获得一个4级精灵",99,99,10006,3,1],[19,"攻速增加_水",[2,2],[4,0.2,0.5],-1,"水精灵攻速+20%","2",99,"10013",3,"3"],[20,"攻速增加_火",[2,1],[4,0.3,0.5],-1,"火精灵攻速+30%","2",99,"10013",3,"2"],[21,"攻速增加_木",[2,3],[4,0.2,0.5],-1,"木精灵攻速+20%","2",99,"10013",3,"3"],[22,"暴击_木",[3,109],[5,300,0],-1,"木系精灵暴击率+30%","3",99,"10012",3,"2"],[23,"暴怒_木",[3,109],[6,300,0],-1,"木系精灵暴击伤害+30%","5",99,"10011",3,"2"],[24,"弹夹扩容",[3,109],[7,2,0],-1,"玉米精灵高能子弹+1","3",99,10008,"2","1"],[25,"爆裂狂怒",[3,101],[9,7,0],-1,"火鸟精灵充能后攻速+35%","3",99,10009,"2","1"],[26,"暴击_火",[3,101],[5,200,0],-1,"火系精灵暴击率+20%","3",99,"10012",3,"2"],[27,"暴怒_火",[3,101],[6,300,0],-1,"火系精灵暴击伤害+30%","5",99,"10011",3,"2"],[28,"超级弹夹",[3,109],[7,3,0],-1,"玉米精灵高能子弹+2","7",99,10008,3,"1"],[29,"超级爆裂狂怒",[3,101],[9,9,0],-1,"火鸟精灵充能后攻速+60%","7",99,10009,3,"1"],[30,"技能提升",[4,0],[10,1,0],-1,"全体技能等级+1",0,99,10004,3,1]]
[[1,"低级火灵之力",[2,1],[1,10,0],-1,"增加全体火精灵10%攻击力",0,"3",10001,1,"0"],[2,"低级水灵之力",[2,2],[1,10,0],-1,"增加全体水精灵10%攻击力",0,"3",10002,1,"0"],[3,"低级木灵之力",[2,3],[1,10,0],-1,"增加全体木精灵10%攻击力",0,"3",10003,1,"0"],[4,"火灵之力",[2,1],[1,20,0],-1,"增加全体火精灵20%攻击力","4","7",10001,2,"0"],[5,"水灵之力",[2,2],[1,20,0],-1,"增加全体水精灵20%攻击力","4","7",10002,2,"0"],[6,"木灵之力",[2,3],[1,20,0],-1,"增加全体木精灵20%攻击力","4","7",10003,2,"0"],[7,"高级火灵之力",[2,1],[1,30,0],-1,"增加全体火精灵30%攻击力","8","10",10001,3,"0"],[8,"高级水灵之力",[2,2],[1,30,0],-1,"增加全体水精灵30%攻击力","8","10",10002,3,"0"],[9,"高级木灵之力",[2,3],[1,30,0],-1,"增加全体木精灵30%攻击力","8","10",10003,3,"0"],[10,"特级火灵之力",[2,1],[1,40,0],-1,"增加全体火精灵40%攻击力","11","17",10001,3,"0"],[11,"特级水灵之力",[2,2],[1,40,0],-1,"增加全体水精灵40%攻击力","11","17",10002,3,"0"],[12,"特级木灵之力",[2,3],[1,40,0],-1,"增加全体木精灵40%攻击力","11","17",10003,3,"0"],[13,"精灵之力",[1,0],[1,50,0],2,"2波增加全体精灵50%攻击力","99",99,10004,2,1],[14,"狂暴之力",[1,0],[1,65,0],2,"2波内增加全体精灵65%攻击力","99",99,10005,3,1],[15,"飞来横财",[0],[2,300,0],0,"增加300金币","0","4",10007,1,"0"],[16,"中大奖!",[0],[2,800,0],0,"增加800金币","5","99",10007,3,"0"],[17,"精灵魔盒",[0],[3,3,300],0,"随机获得一个3级精灵",99,99,10006,2,1],[18,"超级精灵魔盒",[0],[3,4,500],0,"随机获得一个4级精灵",99,99,10006,3,1],[19,"攻速增加_水",[2,2],[4,0.2,0.5],-1,"水精灵攻速+20%","2",99,"10013",3,"3"],[20,"攻速增加_火",[2,1],[4,0.3,0.5],-1,"火精灵攻速+30%","2",99,"10013",3,"2"],[21,"攻速增加_木",[2,3],[4,0.2,0.5],-1,"木精灵攻速+20%","2",99,"10013",3,"3"],[22,"暴击_木",[3,109],[5,300,0],-1,"木系精灵暴击率+30%","3",99,"10012",3,"2"],[23,"暴怒_木",[3,109],[6,300,0],-1,"木系精灵暴击伤害+30%","5",99,"10011",3,"2"],[24,"弹夹扩容",[3,109],[7,2,0],-1,"玉米精灵高能子弹+1","3",99,10008,"2","1"],[25,"爆裂狂怒",[3,101],[9,7,0],-1,"火鸟精灵充能后攻速+35%","3",99,10009,"2","1"],[26,"暴击_火",[3,101],[5,200,0],-1,"火系精灵暴击率+20%","3",99,"10012",3,"2"],[27,"暴怒_火",[3,101],[6,300,0],-1,"火系精灵暴击伤害+30%","5",99,"10011",3,"2"],[28,"超级弹夹",[3,109],[7,3,0],-1,"玉米精灵高能子弹+2","7",99,10008,3,"1"],[29,"超级爆裂狂怒",[3,101],[9,9,0],-1,"火鸟精灵充能后攻速+60%","7",99,10009,3,"1"],[30,"技能提升",[4,0],[10,1,0],-1,"全体技能等级+1",0,99,10004,3,1],[31,"快速蓄能",[3,109],[11,0.5,0.5],-1,"玉米精灵蓄力时间-50%",0,99,10008,3,1]]