Example #1
0
        public static bool TryFindRandomEdgeCellNearWith(IntVec3 near, float radius, Map map, Predicate <IntVec3> validator, out IntVec3 spot)
        {
            CellRect            cellRect  = CellRect.CenteredOn(near, Mathf.CeilToInt(radius));
            Predicate <IntVec3> predicate = (IntVec3 x) => x.InHorDistOf(near, radius) && x.OnEdge(map) && validator(x);

            if (CellRect.WholeMap(map).EdgeCellsCount < cellRect.Area)
            {
                return(CellFinder.TryFindRandomEdgeCellWith(predicate, map, CellFinder.EdgeRoadChance_Ignore, out spot));
            }
            return(CellFinder.TryFindRandomCellInsideWith(cellRect, predicate, out spot));
        }