hardDrop method
void
hardDrop()
Drops the piece straight down and locks it, for 2 points per cell.
Implementation
void hardDrop() {
final piece = _activePiece;
if (piece == null) return;
_record('hardDrop');
final ghost = _collision.ghostPiece(piece, _state.board);
final dropped = ghost.position.row - piece.position.row;
if (dropped > 0) _lastMoveWasRotation = false;
_state = _state.copyWith(
activePiece: ghost,
scoreState: _scoring.onHardDrop(_state.scoreState, dropped),
);
_emit(
TetrisEvent(
TetrisEventType.hardDropped,
piece: piece.type,
cells: dropped,
),
);
_lockPiece();
}