Exemple #1
0
        public void findclosestzone(List <Missile> missiles, Radar r, PointF location, PointF targetpos, float orientation, List <Entity> EntityList)
        {
            //takes a look at the pos and current location to determine if it is in the radar's zone
            //start with the infared, then to radar
            //if inside that zone then locked = true
            //check short range infared radar
            if (location.CreateHitTriangle(r.SRInfaredRange, orientation, r.SRInfaredSightAngle / 2).IsPointInPolygon(targetpos))
            {
                //is inside short range infared radar
                if (missiles.Any(p => p.Type == MissileType.srir & p.Active == true)) //ensure that the plane has a weapon to use
                {
                    Status = AutoEngageStatus.Locked;
                    //loose missile
                    Missile m = missiles.First(p => p.Type == MissileType.srir);
                    missiles.Remove(m);
                    //give it the data it needs to keep tracking
                    m.Orientation = orientation;
                    m.Location    = location;
                    m.lockID      = 0;
                    EntityList.Add(m);
                }
                SRIRlock = true;
            }
            else
            {
                SRIRlock = false;
            }

            if (location.CreateHitTriangle(r.SRRadarRange, orientation, r.SRRadarSightAngle / 2).IsPointInPolygon(targetpos))
            {
                //is inside short range infared radar
                if (missiles.Any(p => p.Type == MissileType.srr & p.Active == true)) //ensure that the plane has a weapon to use
                {
                    Status = AutoEngageStatus.Locked;
                    //loose missile
                    //give it the data it needs to keep tracking
                }
                SRRlock = true;
            }
            else
            {
                SRRlock = false;
            }

            if (location.CreateHitTriangle(r.MRRadarRange, orientation, r.MRRadarSightAngle / 2).IsPointInPolygon(targetpos))
            {
                //is inside short range infared radar
                if (missiles.Any(p => p.Type == MissileType.mrr & p.Active == true)) //ensure that the plane has a weapon to use
                {
                    Status = AutoEngageStatus.Locked;
                    //loose missile
                    //give it the data it needs to keep tracking
                }
                MRRlock = true;
            }
            else
            {
                MRRlock = false;
            }
        }
Exemple #2
0
 public AutoEngage()
 {
     Enabled          = false;
     Status           = AutoEngageStatus.NoTarget;
     Mode             = AutoEngageMode.AutoSelect;
     PreferShortRange = true;
 }
Exemple #3
0
 public AutoTarget()
 {
     Enabled                     = false;
     Mode                        = TargetMode.Closest;
     GTFOmode                    = false;
     ConserveFuelmode            = false;
     GuardClosest                = true;
     ReturnToGuard               = false;
     targetPassiveSignalStrength = 0;
     status                      = AutoEngageStatus.NoTarget;
 }
Exemple #4
0
        public PointF find_FurthestTarget(PointF pos, MapComponent map, PointF destination, string team, float range)
        {
            //see if there is an enemy
            //make sure that the enemy is withing radar range
            var querey = map.PassiveRadarMap.FindAll(p => p.Team != team && p.Location.getDistance(pos) <= range / 2);
            var target = querey.OrderBy(p => MathExtensions.getLength(pos, p.Location));

            if (target.Count() > 0)
            {
                targetPassiveSignalStrength = target.Last().Strength;
                status = AutoEngageStatus.Tracking;
                return(target.Last().Location);
            }
            else
            {
                status = AutoEngageStatus.Scanning;
                return(destination);
            }
        }
Exemple #5
0
        public PointF guard_Scan(PointF pos, MapComponent map, string team, float range, bool chase = false)
        {
            //check if any enemy is within in the guard zone
            var querey = map.PassiveRadarMap.FindAll(p => p.Team != team && p.Location.getDistance(GuardPoint) <= GuardAreaRadius && p.Location.getDistance(pos) <= range / 2);
            //find first/last based on request
            var    target = querey.OrderBy(p => MathExtensions.getLength(pos, p.Location));
            PointF tp;

            if (target.Count() > 0)
            {
                if (GuardClosest)
                {
                    targetPassiveSignalStrength = target.First().Strength;
                    tp = target.First().Location;
                }
                else
                {
                    targetPassiveSignalStrength = target.Last().Strength;
                    tp = target.Last().Location;
                }
                //set destination to thier position
                //if in guard to pursue set mode to first/last as in request
                if (chase)
                {
                    if (GuardClosest)
                    {
                        Mode = TargetMode.Closest;
                    }
                    else
                    {
                        Mode = TargetMode.Furthest;
                    }
                }
                status = AutoEngageStatus.Tracking;
                return(tp);
            }
            status = AutoEngageStatus.Scanning;
            return(GuardPoint);
        }