예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }
예제 #4
0
        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);
        }
예제 #5
0
        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);
        }
예제 #6
0
        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);
        }
예제 #7
0
 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);
 }
예제 #8
0
        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);
        }
예제 #9
0
        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);
        }
예제 #10
0
        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);
        }
예제 #11
0
        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);
        }
예제 #12
0
        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);
        }
예제 #13
0
        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);
        }
예제 #14
0
        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);
        }
예제 #15
0
        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);
        }
예제 #16
0
        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);
        }