From 24f59b89e9eabcfe948fc0ba304a8dbec2deda14 Mon Sep 17 00:00:00 2001 From: River Jiang <546213258@qq.com> Date: Tue, 27 Oct 2020 14:09:47 +0800 Subject: [PATCH] Merge branch 'master' of http://172.16.1.52:8090/r/GemBattle into master --- Assets/Scripts/TowerDefense/Level/AgentInsManager.cs | 44 +++++++++++++++++++++++++++++++++++++++----- 1 files changed, 39 insertions(+), 5 deletions(-) diff --git a/Assets/Scripts/TowerDefense/Level/AgentInsManager.cs b/Assets/Scripts/TowerDefense/Level/AgentInsManager.cs index 428ed8d..32240aa 100644 --- a/Assets/Scripts/TowerDefense/Level/AgentInsManager.cs +++ b/Assets/Scripts/TowerDefense/Level/AgentInsManager.cs @@ -10,6 +10,7 @@ using TowerDefense.UI.HUD; using UnityEngine; using UnityEngine.AI; +using TowerDefense.Level; /// <summary> /// 基于兵线的Agent Instance管理器 @@ -223,6 +224,30 @@ return agentWaveLineArray; } + /// <summary> + /// 设置某条兵线的所有小兵的移动状态 + /// </summary> + /// <param name="waveLineId">兵线id 1~5, 如果是-1则设置所有兵线的状态</param> + /// <param name="canMove">是否可以移动</param> + /// <param name="isOppo">是否是敌方</param> + public void SetWaveLineCanMove(int waveLineId, bool canMove, bool isOppo) + { + WaveLineAgentInsMgr[] waveLineAgents = isOppo ? getOppoWaveLineList() : GetWaveLineList(); + + for (int i = 0; i < waveLineAgents.Length; ++i) + { + if (i == waveLineId - 1 || waveLineId == -1) + { + List<Agent> list = waveLineAgents[i].listAgent; + + for (int j = 0; j < list.Count; ++j) + { + list[j].CanMove = canMove; + } + } + } + } + public List<Agent> agentList { get { return this.agentInsList; } @@ -259,12 +284,21 @@ // 这一行防止无限的循环下去。 if (forceGet) return ag; - Agent agLeft = GetMinDisAgent(lineid - 1, oppo, true, noPoison); - Agent agRight = GetMinDisAgent(lineid + 1, oppo, true, noPoison); - agentTmpArr[0] = ag; - agentTmpArr[1] = agLeft; - agentTmpArr[2] = agRight; + + if (!EndlessLevelManager.instanceExists) + { + Agent agLeft = GetMinDisAgent(lineid - 1, oppo, true, noPoison); + Agent agRight = GetMinDisAgent(lineid + 1, oppo, true, noPoison); + + agentTmpArr[1] = agLeft; + agentTmpArr[2] = agRight; + } + else + { + agentTmpArr[1] = null; + agentTmpArr[2] = null; + } float minDis = 100000000f; int idx = -1; -- Gitblit v1.9.1