public static bool TryFindCell(out IntVec3 cell, Map map) { InfestationCellFinder.CalculateLocationCandidates(map); InfestationCellFinder.LocationCandidate locationCandidate; if (!InfestationCellFinder.locationCandidates.TryRandomElementByWeight((InfestationCellFinder.LocationCandidate x) => x.score, out locationCandidate)) { cell = IntVec3.Invalid; return(false); } cell = locationCandidate.cell; return(true); }
public static bool TryFindCell(out IntVec3 cell, Map map) { InfestationCellFinder.CalculateLocationCandidates(map); InfestationCellFinder.LocationCandidate locationCandidate; if (!InfestationCellFinder.locationCandidates.TryRandomElementByWeight((InfestationCellFinder.LocationCandidate x) => x.score, out locationCandidate)) { cell = IntVec3.Invalid; return(false); } cell = CellFinder.FindNoWipeSpawnLocNear(locationCandidate.cell, map, ThingDefOf.Hive, Rot4.North, 2, (IntVec3 x) => InfestationCellFinder.GetScoreAt(x, map) > 0f && x.GetFirstThing(map, ThingDefOf.Hive) == null && x.GetFirstThing(map, ThingDefOf.TunnelHiveSpawner) == null); return(true); }
public static bool TryFindCell(out IntVec3 cell, Map map) { InfestationCellFinder.CalculateLocationCandidates(map); LocationCandidate locationCandidate = default(LocationCandidate); if (!((IEnumerable <LocationCandidate>)InfestationCellFinder.locationCandidates).TryRandomElementByWeight <LocationCandidate>((Func <LocationCandidate, float>)((LocationCandidate x) => x.score), out locationCandidate)) { cell = IntVec3.Invalid; return(false); } cell = locationCandidate.cell; return(true); }