Exemplo n.º 1
0
        public static List <Pheromone> PheromonesNear(PointF pos, World world)
        {
            List <Pheromone> nearPheromones = new List <Pheromone>();

            //if (pos.X > 1 && pos.X < 124 && pos.Y > 1 && pos.Y < 124)
            //{
            pos = Mod(pos, world.size);

            for (int x = -1; x < 2; x++)
            {
                for (int y = -1; y < 2; y++)
                {
                    if ((int)pos.X + x > 0 && (int)pos.X + x < 125)
                    {
                        if ((int)pos.Y + y > 0 && (int)pos.Y + y < 125)
                        {
                            Pheromone pheromoneTest = (Pheromone)pheromones[(int)pos.X + x, (int)pos.Y + y];
                            if (pheromoneTest != null)
                            {
                                if (world.Dist(pos, pheromoneTest.Position) < 1)
                                {
                                    nearPheromones.Add(pheromoneTest);
                                }
                            }
                        }
                    }
                }
            }
            //}
            return(nearPheromones);
        }
Exemplo n.º 2
0
 private void SpawnSomeFood()
 {
     for (int j = 0; j < 3; j++)
     {
         PointF random;
         do
         {
             random = world.RandomPoint();
         }while (world.Dist(world.Center, random) < 50);
         Food.SpawnOn(world, random, world.Random(10, 50));
     }
 }
Exemplo n.º 3
0
 private void SpawnSomeFood() //Spawnea Comida 3 veces o en 3 puntos random del mundo
 {
     for (int j = 0; j < 3; j++)
     {
         PointF random;
         do
         {
             random = world.RandomPoint();
         }while (world.Dist(world.Center, random) < 50);
         Food.SpawnOn(world, random, world.Random(10, 50));
     }
 }
Exemplo n.º 4
0
 private void ReleasePheromone(World world)
 {
     Pheromone.SpawnOn(world, Position, world.Dist(Position, world.Center) * 1.5);
 }