public void GenerateGrid() { if (myGridBundle.Behavior != null) { myGridBundle.Behavior.OnGridReset(); } myGridBundle.Container.RemoveAll(); myGridBundle.Container.GenerateTiles(); myGridBundle.Container.myBlocks = new List <AbstractBlock>(); for (int columns = 0; columns < myGridBundle.Container.GetInitialWidth(); ++columns) { FrozenBlock block = new FrozenBlock(myGridBundle); block.SetPosition(columns, 0); myGridBundle.Container.myBlocks.Add(block); Tile tiley = myGridBundle.Container.myGrid[0][columns]; tiley.SetBlock(block); } for (int rows = 1; rows < myGridBundle.Container.GetInitialHeight(); ++rows) { for (int columns = 0; columns < myGridBundle.Container.GetInitialWidth(); ++columns) { EmptyBlock block = new EmptyBlock(myGridBundle); //ColorBlock block = new ColorBlock(myGridBundle); block.SetPosition(columns, rows); myGridBundle.Container.myBlocks.Add(block); Tile tiley = myGridBundle.Container.myGrid[rows][columns]; tiley.SetBlock(block); } } foreach (AbstractBlock block in myGridBundle.Container.myBlocks) { block.LoadContent(); } myGridBundle.Container.PrintGrid(); myGridBundle.Container.EnsureUnique(); }
public void AddEmptyRow() { myGridBundle.Container.myGrid.Add(new List <Tile>()); int row = myGridBundle.Container.myGrid.Count() - 1; for (int columns = 0; columns < myGridBundle.Container.GetInitialWidth(); ++columns) { Tile tiley = new Tile(); myGridBundle.Container.myGrid[row].Add(tiley); EmptyBlock block = new EmptyBlock(myGridBundle); block.SetPosition(columns, row); //here myGridBundle.Container.myBlocks.Add(block); tiley.SetBlock(block); //myGridBundle.Container.SetBlock(new Point(columns, row), block); } //myGridBundle.Container.EnsureUnique(); }