private void FillLine(CrosswordPosition questionPos, CrosswordOrientation orientation, CrosswordPositionAndOrientation?answerStartPos = null) { if (!InBounds(questionPos)) { return; } var answerTile = answerStartPos.HasValue ? answerStartPos.Value : new CrosswordPositionAndOrientation(GetForwardTilePosition(questionPos, orientation), orientation); if (!mCrossword.GetTile(questionPos).hasValue) { var tile = mCrossword.GetTile(answerTile.position); if (tile is CrosswordTileAnswerItem && !answerStartPos.HasValue) { answerTile.orientation = ((CrosswordTileAnswerItem)tile).oppositeDirection; } SetQuestionTile(questionPos, answerTile, GetMinMaxAnswerLength(answerTile)); } FillLine(answerTile.position, orientation); }
public CrosswordPositionAndOrientation(CrosswordPosition position, CrosswordOrientation orientation) { this.position = position; this.orientation = orientation; }
private CrosswordPosition GetForwardTilePosition(CrosswordPosition pos, CrosswordOrientation orientation, int tileDistance = 1) { pos.row = orientation == CrosswordOrientation.VERTICAL ? pos.row + tileDistance : pos.row; pos.column = orientation == CrosswordOrientation.HORIZONTAL ? pos.column + tileDistance : pos.column; return(pos); }