chenxin
2020-11-19 fdfb88a9ee3652e716e603f759d3be5dcc0bd3bd
Assets/Scripts/TowerDefense/UI/EndlessBossSkill/BossSkillBubbleBomb.cs
@@ -101,8 +101,6 @@
        /// </summary>
        protected List<GameObject> bubbleBombPool;
        protected int capacity = 10;
        private int getCount;
        private int recycleCount;
@@ -209,18 +207,9 @@
        public override void Init()
        {
            base.Init();
            Debug.Log("--------------------- 泡泡炸弹技能初始化 ---------------------");
            Debug.Log("---- 泡泡炸弹技能初始化 ----");
            bubbleBombList = new List<BubbleBombConfig>();
            bubbleBombPool = new List<GameObject>();
            GameObject prefab = Resources.Load<GameObject>(prefabPath);
            for (int i = 0; i < capacity; ++i)
            {
                GameObject obj = GameObject.Instantiate(prefab);
                obj.SetActive(false);
                bubbleBombPool.Add(obj);
            }
        }
        /// <summary>
@@ -298,10 +287,10 @@
                {
                    BubbleBombConfig config = bubbleBombList[i];
                    // 攻击次数够了被打死了 或者 达到基地了
                    if (config.Agent.bInDeathState) return;
                    if (config.IsAttackDeath || config.IsArrived) return;
                    ++config.AttackCount;
                    Debug.Log($"--------------------- BubbleBombAgent Id: {id}, AttackCount:{config.AttackCount} ---------------------");
                    Debug.Log($"---- BubbleBombAgent Id: {id}, AttackCount: {config.AttackCount} ----");
                    if (config.AttackCount >= config.NeedAttackCount)
                        AgentDead(config);
@@ -323,7 +312,7 @@
                {
                    BubbleBombConfig config = bubbleBombList[i];
                    if (config.Agent.bInDeathState) return;
                    if (config.IsAttackDeath || config.IsArrived) return;
                    AgentDead(config);
                    break;
@@ -344,7 +333,7 @@
                {
                    BubbleBombConfig config = bubbleBombList[i];
                    if (config.Agent.bInDeathState) return;
                    if (config.IsAttackDeath || config.IsArrived) return;
                    config.IsDizzinessed = true;
                    config.Agent.CanMove = false;
@@ -361,11 +350,10 @@
        /// <param name="config"></param>
        private void AgentDead(BubbleBombConfig config)
        {
            config.IsAttackDeath = true;
            AgentInsManager.instance.removeAgent(config.Agent);
            config.Agent.StopNormalEffect();
            config.Agent.PlayExplodeEffect();
            AgentInsManager.instance.removeAgent(config.Agent);
            config.Agent.bInDeathState = true;
            config.IsAttackDeath = true;
        }
        /// <summary>
@@ -375,10 +363,9 @@
        private void AgentArrived(BubbleBombConfig config)
        {
            config.IsArrived = true;
            AgentInsManager.instance.removeAgent(config.Agent);
            config.Agent.StopNormalEffect();
            config.Agent.PlayExplodeEffect();
            AgentInsManager.instance.removeAgent(config.Agent);
            config.Agent.bInDeathState = true;
        }
        public override void Update(float deltaTime)
@@ -433,7 +420,7 @@
                }
                // 更新移动
                if (config.Agent != null && !config.Agent.bInDeathState && config.Agent.CanMove)
                if (config.Agent.CanMove)
                {
                    Vector3 pos = config.obj.transform.position;
                    pos.z -= deltaTime * config.MoveSpeed;
@@ -449,7 +436,7 @@
                else
                {
                    // cx test
                    Debug.Log("--------------------- 泡泡炸弹不能移动 ---------------------");
                    Debug.LogError("---- 泡泡炸弹不能移动??? ----");
                }
            }
        }