private TetrisPiece MakeRandomPiece() { int pieceIndex = _random.Next(_prototypePieces.Length); TetrisPiece prototypePiece = _prototypePieces[pieceIndex]; TetrisPiece piece = (TetrisPiece)prototypePiece.Clone(); piece.Color = _colorFactory.MakeRandomColor(); RotatePieceRandomly(piece); return(piece); }
public TetrisState GetState() { TetrisState state = new TetrisState(Rows, Columns); FixedBricksLogic.CopyFixedBricksInState(state); if (CurrentPiece != null) { state.CurrentPiece = (TetrisPieceWithPosition)CurrentPiece.Clone(); } state.NextPiece = (TetrisPiece)NextPiece.Clone(); return(state); }