Esempio n. 1
0
        // Return the primary landing pad if available and reaching map edge
        //     else a random one
        //     else null.
        public static Building_LandingPad GetBestAvailableLandingPadReachingMapEdge(Map map)
        {
            IntVec3 exitSpot = IntVec3.Invalid;
            // Check pawns can reach map edge from best landing pad.
            Building_LandingPad bestLandingPad = GetBestAvailableLandingPad(map);

            if (bestLandingPad != null)
            {
                if (Expedition.TryFindRandomExitSpot(map, bestLandingPad.Position, out exitSpot))
                {
                    return(bestLandingPad);
                }
            }
            // Check pawns can exit map from any landing pad.
            List <Building_LandingPad> allAvailableLandingPads = Util_LandingPad.GetAllFreeAndPoweredLandingPads(map);

            if (allAvailableLandingPads != null)
            {
                foreach (Building_LandingPad landingPad in allAvailableLandingPads.InRandomOrder())
                {
                    if (Expedition.TryFindRandomExitSpot(map, landingPad.Position, out exitSpot))
                    {
                        return(landingPad);
                    }
                }
            }
            return(null);
        }
 /// <summary>
 /// Check if a landing pad is available.
 /// </summary>
 public void UpdateLandingPadAvailability()
 {
     this.landingPadIsAvailable = (Util_LandingPad.GetAllFreeAndPoweredLandingPads(this.Map) != null);
 }