添加判空逻辑
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)
|
||||
{
|
||||
List<UnmannedAerialVehicleManage> 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<FormationManager>
|
|||
public void RemoveUAMGroupAirRoute(int uavmGroupID)
|
||||
{
|
||||
List<UnmannedAerialVehicleManage> 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<FormationManager>
|
|||
public void SetGroupAttackByGroupID(int uavmGroupID, bool isOpen)
|
||||
{
|
||||
List<UnmannedAerialVehicleManage> 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<FormationManager>
|
|||
public void SetGroupUAVMState(int uavmGroupID, int patternCut)
|
||||
{
|
||||
List<UnmannedAerialVehicleManage> 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<FormationManager>
|
|||
public void RemoveAppointWRJ(UnmannedAerialVehicleManage uavm)
|
||||
{
|
||||
List<UnmannedAerialVehicleManage> 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<FormationManager>
|
|||
|
||||
private List<UnmannedAerialVehicleManage> GroupUAVM(int uavmGroupID)
|
||||
{
|
||||
if (formationInfos.Count == 0) return null;
|
||||
List<UnmannedAerialVehicleManage> uavms = new List<UnmannedAerialVehicleManage>();
|
||||
for (int i = 0; i < formationInfos.Count; i++)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue