Esempio n. 1
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);
                    }
                }
            }
        }