public static TargetInfo GetClosestMissileTarget(MissileFire mf) { BDArmorySetup.BDATeams team = BoolToTeam(mf.team); TargetInfo finalTarget = null; List <TargetInfo> .Enumerator target = TargetDatabase[team].GetEnumerator(); while (target.MoveNext()) { if (target.Current == null) { continue; } if (target.Current && target.Current.Vessel && mf.CanSeeTarget(target.Current) && target.Current.isMissile) { bool isHostile = false; if (target.Current.isThreat) { isHostile = true; } if (isHostile && (finalTarget == null || target.Current.IsCloser(finalTarget, mf))) { finalTarget = target.Current; } } } target.Dispose(); return(finalTarget); }
public static List <TargetInfo> GetAllTargetsExcluding(List <TargetInfo> excluding, MissileFire mf) { List <TargetInfo> finalTargets = new List <TargetInfo>(); BDArmorySettings.BDATeams team = BoolToTeam(mf.team); foreach (var target in TargetDatabase[team]) { if (target && target.Vessel && mf.CanSeeTarget(target.Vessel) && !excluding.Contains(target)) { finalTargets.Add(target); } } return(finalTargets); }
public static TargetInfo GetUnengagedMissileTarget(MissileFire mf) { BDArmorySettings.BDATeams team = mf.team ? BDArmorySettings.BDATeams.B : BDArmorySettings.BDATeams.A; foreach (var target in TargetDatabase[team]) { if (target && target.Vessel && mf.CanSeeTarget(target.Vessel) && target.isMissile && target.isThreat) { if (target.numFriendliesEngaging == 0) { return(target); } } } return(null); }
public static TargetInfo GetLeastEngagedTarget(MissileFire mf) { BDArmorySettings.BDATeams team = mf.team ? BDArmorySettings.BDATeams.B : BDArmorySettings.BDATeams.A; TargetInfo finalTarget = null; foreach (var target in TargetDatabase[team]) { if (target && target.Vessel && mf.CanSeeTarget(target.Vessel) && !target.isMissile) { if (finalTarget == null || target.numFriendliesEngaging < finalTarget.numFriendliesEngaging) { finalTarget = target; } } } return(finalTarget); }
public static TargetInfo GetClosestTarget(MissileFire mf) { BDArmorySettings.BDATeams team = mf.team ? BDArmorySettings.BDATeams.B : BDArmorySettings.BDATeams.A; TargetInfo finalTarget = null; foreach (var target in TargetDatabase[team]) { if (target && target.Vessel && mf.CanSeeTarget(target.Vessel) && !target.isMissile) { if (finalTarget == null || (target.IsCloser(finalTarget, mf))) { finalTarget = target; } } } return(finalTarget); }
public static List <TargetInfo> GetAllTargetsExcluding(List <TargetInfo> excluding, MissileFire mf) { List <TargetInfo> finalTargets = new List <TargetInfo>(); List <TargetInfo> .Enumerator target = TargetList(mf.Team).GetEnumerator(); while (target.MoveNext()) { if (target.Current == null) { continue; } if (target.Current && target.Current.Vessel && mf.CanSeeTarget(target.Current) && !excluding.Contains(target.Current)) { finalTargets.Add(target.Current); } } target.Dispose(); return(finalTargets); }
public static TargetInfo GetUnengagedMissileTarget(MissileFire mf) { List <TargetInfo> .Enumerator target = TargetList(mf.Team).GetEnumerator(); while (target.MoveNext()) { if (target.Current == null) { continue; } if (target.Current && target.Current.Vessel && mf.CanSeeTarget(target.Current) && target.Current.isMissile && target.Current.isThreat) { if (target.Current.NumFriendliesEngaging(mf.Team) == 0) { return(target.Current); } } } target.Dispose(); return(null); }
public static TargetInfo GetUnengagedMissileTarget(MissileFire mf) { BDArmorySetup.BDATeams team = mf.team ? BDArmorySetup.BDATeams.B : BDArmorySetup.BDATeams.A; List <TargetInfo> .Enumerator target = TargetDatabase[team].GetEnumerator(); while (target.MoveNext()) { if (target.Current == null) { continue; } if (target.Current && target.Current.Vessel && mf.CanSeeTarget(target.Current) && target.Current.isMissile && target.Current.isThreat) { if (target.Current.numFriendliesEngaging == 0) { return(target.Current); } } } target.Dispose(); return(null); }
public static TargetInfo GetLeastEngagedTarget(MissileFire mf) { TargetInfo finalTarget = null; List <TargetInfo> .Enumerator target = TargetList(mf.Team).GetEnumerator(); while (target.MoveNext()) { if (target.Current == null) { continue; } if (target.Current && target.Current.Vessel && mf.CanSeeTarget(target.Current) && !target.Current.isMissile && target.Current.isThreat) { if (finalTarget == null || target.Current.NumFriendliesEngaging(mf.Team) < finalTarget.NumFriendliesEngaging(mf.Team)) { finalTarget = target.Current; } } } target.Dispose(); return(finalTarget); }
public static TargetInfo GetClosestTarget(MissileFire mf) { TargetInfo finalTarget = null; List <TargetInfo> .Enumerator target = TargetList(mf.Team).GetEnumerator(); while (target.MoveNext()) { if (target.Current == null) { continue; } if (target.Current && target.Current.Vessel && mf.CanSeeTarget(target.Current) && !target.Current.isMissile) { if (finalTarget == null || (target.Current.IsCloser(finalTarget, mf))) { finalTarget = target.Current; } } } target.Dispose(); return(finalTarget); }
public static TargetInfo GetClosestTarget(MissileFire mf) { BDArmorySetup.BDATeams team = mf.team ? BDArmorySetup.BDATeams.B : BDArmorySetup.BDATeams.A; TargetInfo finalTarget = null; List <TargetInfo> .Enumerator target = TargetDatabase[team].GetEnumerator(); while (target.MoveNext()) { if (target.Current == null) { continue; } if (target.Current && target.Current.Vessel && mf.CanSeeTarget(target.Current) && !target.Current.isMissile) { if (finalTarget == null || (target.Current.IsCloser(finalTarget, mf))) { finalTarget = target.Current; } } } target.Dispose(); return(finalTarget); }
public static TargetInfo GetLeastEngagedTarget(MissileFire mf) { BDArmorySettings.BDATeams team = mf.team ? BDArmorySettings.BDATeams.B : BDArmorySettings.BDATeams.A; TargetInfo finalTarget = null; List <TargetInfo> .Enumerator target = TargetDatabase[team].GetEnumerator(); while (target.MoveNext()) { if (target.Current == null) { continue; } if (target.Current && target.Current.Vessel && mf.CanSeeTarget(target.Current) && !target.Current.isMissile && target.Current.isThreat) { if (finalTarget == null || target.Current.numFriendliesEngaging < finalTarget.numFriendliesEngaging) { finalTarget = target.Current; } } } target.Dispose(); return(finalTarget); }
public static TargetInfo GetClosestMissileTarget(MissileFire mf) { BDArmorySettings.BDATeams team = BoolToTeam(mf.team); TargetInfo finalTarget = null; foreach (var target in TargetDatabase[team]) { if (target && target.Vessel && mf.CanSeeTarget(target.Vessel) && target.isMissile) { bool isHostile = false; if (target.isThreat) { isHostile = true; } if (isHostile && (finalTarget == null || target.IsCloser(finalTarget, mf))) { finalTarget = target; } } } return(finalTarget); }
public static TargetInfo GetMissileTarget(MissileFire mf) { BDArmorySettings.BDATeams team = mf.team ? BDArmorySettings.BDATeams.B : BDArmorySettings.BDATeams.A; TargetInfo finalTarget = null; foreach (var target in TargetDatabase[team]) { if (target && target.Vessel && mf.CanSeeTarget(target.Vessel) && target.isMissile) { bool isHostile = false; if (target.missileModule && target.missileModule.targetMf && target.missileModule.targetMf.team == mf.team) { isHostile = true; } if (isHostile && ((finalTarget == null && target.numFriendliesEngaging < 2) || target.numFriendliesEngaging < finalTarget.numFriendliesEngaging)) { finalTarget = target; } } } return(finalTarget); }
public static TargetInfo GetMissileTarget(MissileFire mf, bool targetingMeOnly = false) { BDArmorySetup.BDATeams team = mf.team ? BDArmorySetup.BDATeams.B : BDArmorySetup.BDATeams.A; TargetInfo finalTarget = null; List <TargetInfo> .Enumerator target = TargetDatabase[team].GetEnumerator(); while (target.MoveNext()) { if (target.Current == null) { continue; } if (target.Current && target.Current.Vessel && target.Current.isMissile && target.Current.isThreat && mf.CanSeeTarget(target.Current)) { if (target.Current.MissileBaseModule) { if (targetingMeOnly) { if (Vector3.SqrMagnitude(target.Current.MissileBaseModule.TargetPosition - mf.vessel.CoM) > 60 * 60) { continue; } } } else { if (BDArmorySettings.DRAW_DEBUG_LABELS) { Debug.LogWarning("checking target missile - doesn't have missile module"); } } if (((finalTarget == null && target.Current.numFriendliesEngaging < 2) || (finalTarget != null && target.Current.numFriendliesEngaging < finalTarget.numFriendliesEngaging))) { finalTarget = target.Current; } } } target.Dispose(); return(finalTarget); }
public static TargetInfo GetMissileTarget(MissileFire mf, bool targetingMeOnly = false) { BDArmorySettings.BDATeams team = mf.team ? BDArmorySettings.BDATeams.B : BDArmorySettings.BDATeams.A; TargetInfo finalTarget = null; foreach (var target in TargetDatabase[team]) { if (target && target.Vessel && target.isMissile && target.isThreat && mf.CanSeeTarget(target.Vessel)) { if (target.missileModule) { if (targetingMeOnly) { if (Vector3.SqrMagnitude(target.missileModule.targetPosition - mf.vessel.CoM) > 60 * 60) { continue; } } } else { Debug.LogWarning("checking target missile - doesn't have missile module"); } if (((finalTarget == null && target.numFriendliesEngaging < 2) || target.numFriendliesEngaging < finalTarget.numFriendliesEngaging)) { finalTarget = target; } } } return(finalTarget); }