示例#1
0
        public TetrisGridArray()
        {
            cubeArray = new TetrisCube[ArrayHeight, ArrayWidth];
            //Init the array
            for (int i = 0; i < ArrayHeight; i++)
            {
                for (int j = 0; j < ArrayWidth; j++)
                {
                    cubeArray[i, j] = null;
                }
            }

            //Establish the border

            for (int i = 0; i < ArrayHeight; i++)
            {
                if (i == 0 || i == ArrayHeight - 1)
                {
                    for (int j = 0; j < ArrayWidth; j++)
                    {
                        cubeArray[i, j] = new TetrisCube(7, true);
                    }
                }
                else
                {
                    cubeArray[i, 0] = new TetrisCube(7, true);
                    cubeArray[i, ArrayWidth - 1] = new TetrisCube(7, true);
                }
            }
        }
示例#2
0
 public bool AddCube(int xCoord, int yCoord, int TeColor, bool locked)
 {
     if (cubeArray[yCoord + 1, xCoord + 1] == null)
     {
         cubeArray[yCoord + 1, xCoord + 1] = new TetrisCube(TeColor, locked);
         return(true);
     }
     return(false);
 }