Example #1
0
        protected override void Process()
        {
            output = new EntityCollection();

            foreach (Coordinate chunk in graph.GetCurrentRegion().EnumerateCoordinates())
            {
                System.Random rng = RNG(chunk);
                foreach (Vector2 sample in PoissonSampler.GenerateSamples(rng, radius, Coordinate.scale, Coordinate.scale))
                {
                    Entity e = new Entity(MapToChunkSpace(sample, chunk));
                    output.AddEntity(e);
                }
            }
        protected override void Process()
        {
            output = new EntityCollection();

            foreach (Coordinate chunk in graph.GetCurrentRegion().EnumerateCoordinates())
            {
                System.Random rng            = RNG(chunk);
                Vector2       worldPos       = Coordinate.WorldPosition(chunk);
                int           numberOfPoints = (int)(Coordinate.scale / frequency);
                for (int i = 0; i < numberOfPoints; i++)
                {
                    Vector2 randomPos = rng.NextVector2(worldPos, worldPos + (Vector2.one * Coordinate.scale));
                    output.AddEntity(new Entity(randomPos));
                }
            }
        }
Example #3
0
 protected override void Process()
 {
     output = new EntityCollection();
     foreach (KeyValuePair <Coordinate, HashSet <string> > chunk in input.AllChunks)
     {
         System.Random rng = RNG(chunk.Key);
         foreach (string entityID in chunk.Value)
         {
             for (int x = 0; x < numberToAdd; x++)
             {
                 if (!input.TryGetEntity(entityID, out IEntity entity))
                 {
                     continue;
                 }
                 output.AddEntity(new Entity(entity.Position + rng.GetPointInCircle(maxDistance)));
             }
         }
     }
 }
        protected override void Process()
        {
            output = new EntityCollection();

            foreach (KeyValuePair <Coordinate, HashSet <string> > chunk in entities.AllChunks)
            {
                System.Random RNG = graph.ChunkRandoms[chunk.Key];
                foreach (string entityID in chunk.Value)
                {
                    if (!entities.TryGetEntity(entityID, out IEntity entity))
                    {
                        continue;
                    }
                    if (RNG.NextFloat(0, 1) > sampler.SamplePosition(entity.Position))
                    {
                        output.AddEntity(entity);
                    }
                }
            }
        }
        protected override void Process()
        {
            output = new EntityCollection();

            foreach (KeyValuePair <Coordinate, HashSet <string> > chunk in input.AllChunks)
            {
                System.Random RNG = graph.ChunkRandoms[chunk.Key];
                foreach (string entityID in chunk.Value)
                {
                    if (RNG.Next(0, 100) < chanceOfSurvival)
                    {
                        if (!input.TryGetEntity(entityID, out IEntity entity))
                        {
                            continue;
                        }
                        output.AddEntity(entity);
                    }
                }
            }
        }