Exemplo n.º 1
0
 /// <summary>
 /// Updates the block color in the GUI to what the block is currently set to.
 /// </summary>
 /// <param name="s">The Square to be updated in GUI</param>
 public void UpdateBlockColor(Square s)
 {
     gui.SetBlockColor(s.currentState, s.location);
 }
Exemplo n.º 2
0
        /// <summary>
        /// Creates new grid based on parameters passed in.
        /// </summary>
        public Grid()
        {
            board = new Square[LightBlockEngine.maxX, LightBlockEngine.maxY];

            for (int x = 0; x < LightBlockEngine.maxX; x++)
            {
                for (int y = 0; y < LightBlockEngine.maxY; y++)
                {
                    Square s = new Square(x, y, LightBlockEngine.blockSize);
                    board[x, y] = s;
                }
            }
            //This will add one block for every twelve squares of grid space (rounded down).
            int numberOfBlocks = (LightBlockEngine.maxX * LightBlockEngine.maxY) / 12;
            AddBlocks(numberOfBlocks);
        }