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++) {