| | |
| | | /// </summary> |
| | | protected List<GameObject> bubbleBombPool; |
| | | |
| | | protected int capacity = 10; |
| | | |
| | | private int getCount; |
| | | |
| | | private int recycleCount; |
| | |
| | | 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> |
| | |
| | | { |
| | | 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); |
| | |
| | | { |
| | | BubbleBombConfig config = bubbleBombList[i]; |
| | | |
| | | if (config.Agent.bInDeathState) return; |
| | | if (config.IsAttackDeath || config.IsArrived) return; |
| | | |
| | | AgentDead(config); |
| | | break; |
| | |
| | | { |
| | | BubbleBombConfig config = bubbleBombList[i]; |
| | | |
| | | if (config.Agent.bInDeathState) return; |
| | | if (config.IsAttackDeath || config.IsArrived) return; |
| | | |
| | | config.IsDizzinessed = true; |
| | | config.Agent.CanMove = false; |
| | |
| | | /// <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> |
| | |
| | | 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) |
| | |
| | | } |
| | | |
| | | // 更新移动 |
| | | 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; |
| | |
| | | else |
| | | { |
| | | // cx test |
| | | Debug.Log("--------------------- 泡泡炸弹不能移动 ---------------------"); |
| | | Debug.LogError("---- 泡泡炸弹不能移动??? ----"); |
| | | } |
| | | } |
| | | } |