Time for action – GamePiece class methods – part 2 – rotation
Add the
RotatePiece()
method to the GamePiece class:public void RotatePiece(bool Clockwise) { switch (pieceType) { case "Left,Right": pieceType = "Top,Bottom"; break; case "Top,Bottom": pieceType = "Left,Right"; break; case "Left,Top": if (Clockwise) pieceType = "Top,Right"; else pieceType = "Bottom,Left"; break; case "Top,Right": if (Clockwise) pieceType = "Right,Bottom"; else pieceType = "Left,Top"; break; case "Right,Bottom": if (Clockwise) pieceType = "Bottom,Left"; else pieceType = "Top,Right"; break; case "Bottom,Left": if (Clockwise) ...