Exemple #1
0
 private void RecursiveAddPoint(Group group, int x, int y)
 {
     if (GetContentAt(x, y) == group.Content)
     {
         if (group.ContainsPoint(x, y))
         {
             return;
         }
         group.AddPoint(x, y);
         groupCache2[x, y] = group;
         if (x > 0)
         {
             RecursiveAddPoint(group, x - 1, y);
         }
         if (x < SizeX - 1)
         {
             RecursiveAddPoint(group, x + 1, y);
         }
         if (y > 0)
         {
             RecursiveAddPoint(group, x, y - 1);
         }
         if (y < SizeY - 1)
         {
             RecursiveAddPoint(group, x, y + 1);
         }
     }
     else
     {
         group.AddNeighbour(x, y);
     }
 }
Exemple #2
0
 private void RecursiveAddPoint(Group group, int x, int y)
 {
     if (GetContentAt(x, y) == group.Content)
     {
         if (group.ContainsPoint(x, y)) return;
         group.AddPoint(x, y);
         groupCache2[x, y] = group;
         if (x > 0) RecursiveAddPoint(group, x - 1, y);
         if (x < SizeX - 1) RecursiveAddPoint(group, x + 1, y);
         if (y > 0) RecursiveAddPoint(group, x, y - 1);
         if (y < SizeY - 1) RecursiveAddPoint(group, x, y + 1);
     }
     else
     {
         group.AddNeighbour(x, y);
     }
 }