添加判空逻辑
This commit is contained in:
parent
31e5fc4b92
commit
ee6c275449
|
@ -82,6 +82,7 @@ public class FormationManager : MonoSingleton<FormationManager>
|
||||||
public void SetUAVMGroupAirRoute(int uavmGroupID, Vector3 pos, DistanceMeasurement _airRoute)
|
public void SetUAVMGroupAirRoute(int uavmGroupID, Vector3 pos, DistanceMeasurement _airRoute)
|
||||||
{
|
{
|
||||||
List<UnmannedAerialVehicleManage> uavms = GroupUAVM(uavmGroupID);
|
List<UnmannedAerialVehicleManage> uavms = GroupUAVM(uavmGroupID);
|
||||||
|
if (uavms.Count == 0) return;
|
||||||
for (int j = 0; j < uavms.Count; j++)
|
for (int j = 0; j < uavms.Count; j++)
|
||||||
{
|
{
|
||||||
if (!uavms[j].airRoute)
|
if (!uavms[j].airRoute)
|
||||||
|
@ -99,6 +100,7 @@ public class FormationManager : MonoSingleton<FormationManager>
|
||||||
public void RemoveUAMGroupAirRoute(int uavmGroupID)
|
public void RemoveUAMGroupAirRoute(int uavmGroupID)
|
||||||
{
|
{
|
||||||
List<UnmannedAerialVehicleManage> uavms = GroupUAVM(uavmGroupID);
|
List<UnmannedAerialVehicleManage> uavms = GroupUAVM(uavmGroupID);
|
||||||
|
if (uavms.Count == 0) return;
|
||||||
for (int j = 0; j < uavms.Count; j++)
|
for (int j = 0; j < uavms.Count; j++)
|
||||||
{
|
{
|
||||||
uavms[j].positions.Clear();
|
uavms[j].positions.Clear();
|
||||||
|
@ -110,6 +112,7 @@ public class FormationManager : MonoSingleton<FormationManager>
|
||||||
public void SetGroupAttackByGroupID(int uavmGroupID, bool isOpen)
|
public void SetGroupAttackByGroupID(int uavmGroupID, bool isOpen)
|
||||||
{
|
{
|
||||||
List<UnmannedAerialVehicleManage> uavms = GroupUAVM(uavmGroupID);
|
List<UnmannedAerialVehicleManage> uavms = GroupUAVM(uavmGroupID);
|
||||||
|
if (uavms.Count == 0) return;
|
||||||
for (int j = 0; j < uavms.Count; j++)
|
for (int j = 0; j < uavms.Count; j++)
|
||||||
{
|
{
|
||||||
int index = j;
|
int index = j;
|
||||||
|
@ -136,6 +139,7 @@ public class FormationManager : MonoSingleton<FormationManager>
|
||||||
public void SetGroupUAVMState(int uavmGroupID, int patternCut)
|
public void SetGroupUAVMState(int uavmGroupID, int patternCut)
|
||||||
{
|
{
|
||||||
List<UnmannedAerialVehicleManage> uavms = GroupUAVM(uavmGroupID);
|
List<UnmannedAerialVehicleManage> uavms = GroupUAVM(uavmGroupID);
|
||||||
|
if (uavms.Count == 0) return;
|
||||||
for (int j = 0; j < uavms.Count; j++)
|
for (int j = 0; j < uavms.Count; j++)
|
||||||
{
|
{
|
||||||
uavms[j].modeSwitch(patternCut);
|
uavms[j].modeSwitch(patternCut);
|
||||||
|
@ -148,6 +152,7 @@ public class FormationManager : MonoSingleton<FormationManager>
|
||||||
public void RemoveAppointWRJ(UnmannedAerialVehicleManage uavm)
|
public void RemoveAppointWRJ(UnmannedAerialVehicleManage uavm)
|
||||||
{
|
{
|
||||||
List<UnmannedAerialVehicleManage> uavms = GroupUAVM(uavm.groupId);
|
List<UnmannedAerialVehicleManage> uavms = GroupUAVM(uavm.groupId);
|
||||||
|
if (uavms.Count == 0) return;
|
||||||
if (uavms.Contains(uavm))
|
if (uavms.Contains(uavm))
|
||||||
uavms.Remove(uavm);
|
uavms.Remove(uavm);
|
||||||
if (allUavms.Contains(uavm))
|
if (allUavms.Contains(uavm))
|
||||||
|
@ -161,6 +166,7 @@ public class FormationManager : MonoSingleton<FormationManager>
|
||||||
|
|
||||||
private List<UnmannedAerialVehicleManage> GroupUAVM(int uavmGroupID)
|
private List<UnmannedAerialVehicleManage> GroupUAVM(int uavmGroupID)
|
||||||
{
|
{
|
||||||
|
if (formationInfos.Count == 0) return null;
|
||||||
List<UnmannedAerialVehicleManage> uavms = new List<UnmannedAerialVehicleManage>();
|
List<UnmannedAerialVehicleManage> uavms = new List<UnmannedAerialVehicleManage>();
|
||||||
for (int i = 0; i < formationInfos.Count; i++)
|
for (int i = 0; i < formationInfos.Count; i++)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue