Exemple #1
0
 public static bool TryGetRandomCellWith(Predicate <IntVec3> validator, Map map, int maxTries, out IntVec3 result)
 {
     for (int i = 0; i < maxTries; i++)
     {
         result = CellFinder.RandomCell(map);
         if (validator(result))
         {
             return(true);
         }
     }
     result = IntVec3.Invalid;
     return(false);
 }
Exemple #2
0
        public override void Generate(Map map, GenStepParams parms)
        {
            int num = Mathf.RoundToInt((float)map.Area / 10000f * this.patchesPer10kCellsRange.RandomInRange);

            for (int i = 0; i < num; i++)
            {
                float   randomInRange = this.patchSizeRange.RandomInRange;
                IntVec3 a             = CellFinder.RandomCell(map);
                foreach (IntVec3 current in GenRadial.RadialPatternInRadius(randomInRange / 2f))
                {
                    IntVec3 c = a + current;
                    if (c.InBounds(map))
                    {
                        map.terrainGrid.SetTerrain(c, this.terrainDef);
                    }
                }
            }
        }
Exemple #3
0
        public override void Generate(Map map)
        {
            int num = Mathf.RoundToInt((float)((float)map.Area / 10000.0 * this.patchesPer10kCellsRange.RandomInRange));

            for (int i = 0; i < num; i++)
            {
                float   randomInRange = this.patchSizeRange.RandomInRange;
                IntVec3 a             = CellFinder.RandomCell(map);
                foreach (IntVec3 item in GenRadial.RadialPatternInRadius((float)(randomInRange / 2.0)))
                {
                    IntVec3 c = a + item;
                    if (c.InBounds(map))
                    {
                        map.terrainGrid.SetTerrain(c, this.terrainDef);
                    }
                }
            }
        }