private void Empty(object sender, RoutedEventArgs e) { if (col == 0) { MessageBox.Show("Введите количество столбцов"); } if (row == 0) { MessageBox.Show("Введите количество рядков"); } if (i < col) { Empty_Cell w = new Empty_Cell(CurX, CurY); cons_canv.Children.Add(w.Uielement); Canvas.SetLeft(w.Uielement, w.X); Canvas.SetTop(w.Uielement, w.Y); CurX += step; map[h, i] = w; i++; } else { h++; if (h >= row) { return; } i = 0; CurX = 0; CurY += step; } }
public void Validate() { for (int i = 0; i < Rows; i++) { for (int j = 0; j < Columns; j++) { if (world[i, j].sym == 'o') { world[i, j] = new Wall(world[i, j].X, world[i, j].Y); } if (world[i, j].sym == ' ') { world[i, j] = new Empty_Cell(world[i, j].X, world[i, j].Y); } if (world[i, j].sym == '#') { world[i, j] = new Brick_Wall(world[i, j].X, world[i, j].Y); } if (world[i, j].sym == '&') { world[i, j] = new Finish(world[i, j].X, world[i, j].Y); } } } }