示例#1
0
文件: S2.cs 项目: Hugo-Persson/Tetris
 public override void Rotate()
 {
     afterRotate = new Cubes[4];
     if (rotation == 2 || rotation == 4)
     {
         afterRotate[1] = new Cubes(currentPos, color);
         afterRotate[0] = new Cubes(new Point(currentPos.X, currentPos.Y + gridSize), color);
         afterRotate[2] = new Cubes(new Point(currentPos.X - gridSize, currentPos.Y), color);
         afterRotate[3] = new Cubes(new Point(currentPos.X - gridSize, currentPos.Y - gridSize), color);
     }
     if (rotation == 1 || rotation == 3)
     {
         afterRotate[1] = new Cubes(currentPos, color);
         afterRotate[0] = new Cubes(new Point(currentPos.X - gridSize, currentPos.Y), color);
         afterRotate[2] = new Cubes(new Point(currentPos.X, currentPos.Y - gridSize), color);
         afterRotate[3] = new Cubes(new Point(currentPos.X + gridSize, currentPos.Y - gridSize), color);
     }
     if (RotationCheck())
     {
         rotation++;
         if (rotation == 5)
         {
             rotation = 1;
         }
         activeCubes = afterRotate;
     }
 }
示例#2
0
 public Square(Point point)
 {
     this.currentPos = point;
     activeCubes[0]  = new Cubes(point, Color.Yellow);
     activeCubes[1]  = new Cubes(new Point(point.X + gridSize, point.Y), Color.Yellow);
     activeCubes[2]  = new Cubes(new Point(point.X, point.Y - gridSize), Color.Yellow);
     activeCubes[3]  = new Cubes(new Point(point.X + gridSize, point.Y - gridSize), Color.Yellow);
 }
示例#3
0
 public TSymbol(Point point)
 {
     color           = Color.Purple;
     this.currentPos = point;
     activeCubes[1]  = new Cubes(point, Color.Purple);
     activeCubes[0]  = new Cubes(new Point(point.X - gridSize, point.Y), Color.Purple);
     activeCubes[2]  = new Cubes(new Point(point.X + gridSize, point.Y), Color.Purple);
     activeCubes[3]  = new Cubes(new Point(point.X, point.Y - gridSize), Color.Purple);
 }
示例#4
0
文件: S2.cs 项目: Hugo-Persson/Tetris
 public S2(Point point)
 {
     this.currentPos = point;
     color           = Color.Green;
     activeCubes[1]  = new Cubes(point, color);
     activeCubes[0]  = new Cubes(new Point(point.X, point.Y + gridSize), color);
     activeCubes[2]  = new Cubes(new Point(point.X - gridSize, point.Y), color);
     activeCubes[3]  = new Cubes(new Point(point.X - gridSize, point.Y - gridSize), color);
 }
示例#5
0
 public Stick(Point point)
 {
     color           = Color.Cyan;
     this.currentPos = point;
     activeCubes[0]  = new Cubes(new Point(currentPos.X, currentPos.Y - gridSize), color);
     activeCubes[1]  = new Cubes(new Point(currentPos.X - gridSize, currentPos.Y - gridSize), color);
     activeCubes[2]  = new Cubes(new Point(currentPos.X + gridSize, currentPos.Y - gridSize), color);
     activeCubes[3]  = new Cubes(new Point(currentPos.X + gridSize * 2, currentPos.Y - gridSize), color);
 }
示例#6
0
文件: L2.cs 项目: Hugo-Persson/Tetris
 public L2(Point point)
 {
     color          = Color.Blue;
     currentPos     = point;
     activeCubes[1] = new Cubes(point, color);
     activeCubes[0] = new Cubes(new Point(point.X - gridSize, point.Y), color);
     activeCubes[2] = new Cubes(new Point(point.X + gridSize, point.Y), color);
     activeCubes[3] = new Cubes(new Point(point.X - gridSize, point.Y - gridSize), color);
 }
示例#7
0
文件: L1.cs 项目: Hugo-Persson/Tetris
 public L1(Point point)
 {
     base.currentPos = point;
     color           = Color.Orange;
     activeCubes[1]  = new Cubes(point, color);
     activeCubes[0]  = new Cubes(new Point(point.X + gridSize, point.Y), color);
     activeCubes[2]  = new Cubes(new Point(point.X - gridSize, point.Y), color);
     activeCubes[3]  = new Cubes(new Point(point.X + gridSize, point.Y - gridSize), color);
 }
示例#8
0
 /// <summary>
 /// Return the column of the cube
 /// </summary>
 /// <param name="cube"></param>
 /// <returns></returns>
 public static int ColumnNumber(Cubes cube)
 {
     return(((cube.point.X - (maxLeftPos - gridSize)) / gridSize) - 1);
 }
示例#9
0
        } //End ClearRows()

        /// <summary>
        /// Return the row of the cube
        /// </summary>
        /// <param name="cube"></param>
        /// <returns></returns>
        public static int RowNumber(Cubes cube)
        {
            return((cube.point.Y - startPos.Y) / gridSize);
        }