From 8d10b61b215a3fad7eb53a7e7ee4dc9e9987d262 Mon Sep 17 00:00:00 2001
From: chenxin <chenxin6991@163.com>
Date: Tue, 27 Oct 2020 10:18:22 +0800
Subject: [PATCH] 无尽模式改为只攻击自己对应的兵线

---
 Assets/Scripts/TowerDefense/Level/AgentInsManager.cs |   20 +++++++++++++++-----
 1 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/Assets/Scripts/TowerDefense/Level/AgentInsManager.cs b/Assets/Scripts/TowerDefense/Level/AgentInsManager.cs
index f8c2d16..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管理器
@@ -283,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