From ee6c27544926efb6e917bf3e128b357b8250f2b9 Mon Sep 17 00:00:00 2001 From: YangHua <1475658476@qq.com> Date: Fri, 8 Mar 2024 15:13:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=88=A4=E7=A9=BA=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Zion/Scripts/Adam/FormationManager.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Assets/Zion/Scripts/Adam/FormationManager.cs b/Assets/Zion/Scripts/Adam/FormationManager.cs index c4217795..58fb20fc 100644 --- a/Assets/Zion/Scripts/Adam/FormationManager.cs +++ b/Assets/Zion/Scripts/Adam/FormationManager.cs @@ -82,6 +82,7 @@ public class FormationManager : MonoSingleton public void SetUAVMGroupAirRoute(int uavmGroupID, Vector3 pos, DistanceMeasurement _airRoute) { List uavms = GroupUAVM(uavmGroupID); + if (uavms.Count == 0) return; for (int j = 0; j < uavms.Count; j++) { if (!uavms[j].airRoute) @@ -99,6 +100,7 @@ public class FormationManager : MonoSingleton public void RemoveUAMGroupAirRoute(int uavmGroupID) { List uavms = GroupUAVM(uavmGroupID); + if (uavms.Count == 0) return; for (int j = 0; j < uavms.Count; j++) { uavms[j].positions.Clear(); @@ -110,6 +112,7 @@ public class FormationManager : MonoSingleton public void SetGroupAttackByGroupID(int uavmGroupID, bool isOpen) { List uavms = GroupUAVM(uavmGroupID); + if (uavms.Count == 0) return; for (int j = 0; j < uavms.Count; j++) { int index = j; @@ -136,6 +139,7 @@ public class FormationManager : MonoSingleton public void SetGroupUAVMState(int uavmGroupID, int patternCut) { List uavms = GroupUAVM(uavmGroupID); + if (uavms.Count == 0) return; for (int j = 0; j < uavms.Count; j++) { uavms[j].modeSwitch(patternCut); @@ -148,6 +152,7 @@ public class FormationManager : MonoSingleton public void RemoveAppointWRJ(UnmannedAerialVehicleManage uavm) { List uavms = GroupUAVM(uavm.groupId); + if (uavms.Count == 0) return; if (uavms.Contains(uavm)) uavms.Remove(uavm); if (allUavms.Contains(uavm)) @@ -161,6 +166,7 @@ public class FormationManager : MonoSingleton private List GroupUAVM(int uavmGroupID) { + if (formationInfos.Count == 0) return null; List uavms = new List(); for (int i = 0; i < formationInfos.Count; i++) {