public EmptyBlock GenerateEmptyBlockAtPosition(Point aPosition) { EmptyBlock block = new EmptyBlock(myGridBundle); block.LoadContent(); myGridBundle.Container.SetBlock(aPosition, block); return(block); }
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(); }