public bool Rotate(StaticData.RotationType rt, int BoardX, int BoardY, int[,] CurrentBoard, int[,] MergeBoard) { // first copy the CurrentBoard to the MergeBoard this.CopyBoard(BoardX, BoardY, CurrentBoard, MergeBoard); // check the rotation performed on the tetromino switch (rt) { case Globals.StaticData.RotationType.RotateLeft: return(this.RotateLeft(BoardX, BoardY, CurrentBoard, MergeBoard)); case Globals.StaticData.RotationType.RotateRight: return(this.RotateRight(BoardX, BoardY, CurrentBoard, MergeBoard)); default: throw new NotImplementedException("Unknown rotate function on the Tetromino Class."); } }
public void RotatePiece(StaticData.RotationType rt) { // copy the current merge board to the previous merge board. // so later in the diff board we will get the correct data, which block we need to update? this.CopyMergeToPrevMerge(); // check which tetromino will be performed, and rotate the piece switch (this.CurrentTetromino) { case 1: this.TetrominoI.Rotate(rt, this.x, this.y, this.CurrentBoard, this.MergeBoard); break; case 2: this.TetrominoJ.Rotate(rt, this.x, this.y, this.CurrentBoard, this.MergeBoard); break; case 3: this.TetrominoL.Rotate(rt, this.x, this.y, this.CurrentBoard, this.MergeBoard); break; case 4: this.TetrominoO.Rotate(rt, this.x, this.y, this.CurrentBoard, this.MergeBoard); break; case 5: this.TetrominoS.Rotate(rt, this.x, this.y, this.CurrentBoard, this.MergeBoard); break; case 6: this.TetrominoT.Rotate(rt, this.x, this.y, this.CurrentBoard, this.MergeBoard); break; case 7: this.TetrominoZ.Rotate(rt, this.x, this.y, this.CurrentBoard, this.MergeBoard); break; } }