예제 #1
0
 public bool CheckForRoundabout(PuzzleRoad road, PuzzleRoad relevantRoad)
 {
     if (road.StartsAndEndsAtSameOrientation && !road.EndPuzzleIndex.HasValue &&
         relevantRoad.StartsAndEndsAtSameOrientation && !relevantRoad.EndPuzzleIndex.HasValue)
     {
         OpenPuzzleRoads.Remove(road);
         OpenPuzzleRoads.Remove(relevantRoad);
         return(true);
     }
     return(false);
 }
예제 #2
0
        public void ChangePuzzleRoadListsBasedOnEndings(PuzzleRoad road, PuzzleRoad relevantRoad)
        {
            var amountOfOpenRoadEnds = AmountOfOpenRoadEnds(relevantRoad);

            if (amountOfOpenRoadEnds == 2)
            {
                //The relevantroad is still open, we need to further connect roads to the road object.
                OpenPuzzleRoads.Remove(relevantRoad);
            }
            else if (amountOfOpenRoadEnds == 1)
            {
                //We connected 2 roads which makes 1 definitive road.
                OpenPuzzleRoads.Remove(road);
                DefinitivePuzzleRoads.Add(road);
                OpenPuzzleRoads.Remove(relevantRoad);
            }
            else if (amountOfOpenRoadEnds == 0)
            {
                //This shouldn't happen in practice.
                OpenPuzzleRoads.Remove(relevantRoad);
            }
        }