Exemple #1
0
 protected override void Apply(Point coords, Grid grid)
 {
     if (0 <= coords.X && coords.X <= 2 * grid.Width + 1 && 0 <= coords.Y && coords.Y <= 2 * grid.Height + 1)
     {
         int dx = coords.Y % 2; //schválně "naopak", zajímá mě lichost v kolmém směru
         int dy = coords.X % 2;
         int x  = coords.X - dx;
         int y  = coords.Y - dy;
         if (Grid.Directions.All(d => !grid.Bridges[grid.ModW((x + dx * d.X) / 2), grid.ModH((y + dy * d.Y) / 2)]))
         {
             grid.Walls[grid.Mod2W(coords.X), grid.Mod2H(coords.Y)] ^= true;
         }
     }
 }