chenxin
2020-11-06 893f645dafa46b818a2edb9fa40337af0c3598d6
Assets/Scripts/TowerDefense/Agents/HomeBaseAttacker.cs
@@ -51,51 +51,47 @@
            var damager = GetComponent<Damager>();
            if (damager != null)
            {
                m_FinalDestinationDamageableBehaviour.TakeDamage(damager.finalDamage, transform.position, agent.configuration.alignmentProvider);
                PlayerHomeBase homebase = m_FinalDestinationDamageableBehaviour.GetComponent<PlayerHomeBase>();
                if (homebase && (!homebase.isDead))
                if (!EndlessLevelManager.instanceExists)
                {
                    // 显示塔位血条
                    float hscale = homebase.healthVal / homebase.configuration.maxHealth;
                    if (hscale < 1.0)
                    m_FinalDestinationDamageableBehaviour.TakeDamage(damager.finalDamage, transform.position, agent.configuration.alignmentProvider);
                    PlayerHomeBase homebase = m_FinalDestinationDamageableBehaviour.GetComponent<PlayerHomeBase>();
                    if (homebase && (!homebase.isDead))
                    {
                        if (homebase.opponent)
                            OpponentMgr.instance.m_CurrentArea.setTowerPosHealth(homebase.homebaseIdx, hscale);
                        else
                        // 显示塔位血条
                        float hscale = homebase.healthVal / homebase.configuration.maxHealth;
                        if (hscale < 1.0)
                        {
                            if (GameUI.instanceExists)
                            if (homebase.opponent)
                                OpponentMgr.instance.m_CurrentArea.setTowerPosHealth(homebase.homebaseIdx, hscale);
                            else
                            {
                                if (null != GameUI.instance.selfTowerPlaceArea)
                                    GameUI.instance.selfTowerPlaceArea.setTowerPosHealth(homebase.homebaseIdx, hscale);
                            }
                            else if (EndlessGameUI.instanceExists)
                            {
                                if (EndlessGameUI.instance.selfTowerPlaceArea != null)
                                {
                                    if (GameConfig.IsNewbie)
                                    {
                                        if (GameConfig.TowerFirstTakeDamage)
                                        {
                                            GameConfig.TowerFirstTakeDamage = false;
                                            EventCenter.Ins.BroadCast((int)KTGMGemClient.EventType.EndlessLoseHeart, 1);
                                            EndlessLevelManager.instance.StopSecondWave();
                                        }
                                        else
                                        {
                                            if (GameConfig.TowerCanTakeDamage)
                                                EventCenter.Ins.BroadCast((int)KTGMGemClient.EventType.EndlessLoseHeart, 1);
                                        }
                                    }
                                    else
                                        EventCenter.Ins.BroadCast((int)KTGMGemClient.EventType.EndlessLoseHeart, 1);
                                }
                            }
                        }
                    }
                }
                else
                {
                    if (GameConfig.IsNewbie)
                    {
                        if (GameConfig.TowerFirstTakeDamage)
                        {
                            GameConfig.TowerFirstTakeDamage = false;
                            EventCenter.Ins.BroadCast((int)KTGMGemClient.EventType.EndlessLoseHeart, 1);
                            EndlessLevelManager.instance.StopSecondWave();
                        }
                        else
                        {
                            if (GameConfig.TowerCanTakeDamage)
                                EventCenter.Ins.BroadCast((int)KTGMGemClient.EventType.EndlessLoseHeart, 1);
                        }
                    }
                    else
                        EventCenter.Ins.BroadCast((int)KTGMGemClient.EventType.EndlessLoseHeart, 1);
                }
            }
            agent.Remove();
        }