Example #1
0
        private IEnumerable <Combination> EnumerateVariations(Combination Combination)
        {
            yield return(Combination);

            // Switch base and overlay
            yield return(new Combination
            {
                BasePiece = Combination.OverlayPiece,
                OverlayPiece = Combination.BasePiece,
                OverlayRelativeOrientation = OrientationHelper.Relative(Combination.OverlayRelativeOrientation, PieceOrientation.North),
                Result = Combination.Result,
                ResultRelativeOrientation = OrientationHelper.Relative(Combination.OverlayRelativeOrientation, Combination.ResultRelativeOrientation)
            });

            // Result with Base laid over it
            yield return(new Combination
            {
                BasePiece = Combination.Result,
                OverlayPiece = Combination.BasePiece,
                OverlayRelativeOrientation = OrientationHelper.Relative(Combination.ResultRelativeOrientation, PieceOrientation.North),
                Result = Combination.Result,
                ResultRelativeOrientation = PieceOrientation.North
            });

            // Result with overlay laid over it
            yield return(new Combination
            {
                BasePiece = Combination.Result,
                OverlayPiece = Combination.OverlayPiece,
                OverlayRelativeOrientation = OrientationHelper.Relative(Combination.ResultRelativeOrientation, Combination.OverlayRelativeOrientation),
                Result = Combination.Result,
                ResultRelativeOrientation = PieceOrientation.North
            });
        }
 public JunctionPattern Rotate()
 {
     return(new JunctionPattern
     {
         Pieces = Pieces.Select(piece =>
                                new JunctionPiece
         {
             Offset = new Point(piece.Offset.Y, -piece.Offset.X),
             RailPiece = piece.RailPiece,
             Orientation = OrientationHelper.Rotate(piece.Orientation, 1)
         }
                                ).ToList(),
         Entrance = Entrance == null ? null :
                    new JunctionPortal
         {
             Offset = new Point(Entrance.Offset.Y, -Entrance.Offset.X),
             Direction = OrientationHelper.Rotate(Entrance.Direction, 1)
         },
         Exit = Exit == null ? null :
                new JunctionPortal
         {
             Offset = new Point(Exit.Offset.Y, -Exit.Offset.X),
             Direction = OrientationHelper.Rotate(Exit.Direction, 1)
         },
     });
 }
Example #3
0
 public JunctionPattern Rotate()
 {
     return(new JunctionPattern
     {
         Pieces = Pieces.Select(piece =>
                                new JunctionPiece
         {
             Offset = new Point(piece.Offset.Y, -piece.Offset.X),
             RailPiece = piece.RailPiece,
             Orientation = OrientationHelper.Rotate(piece.Orientation, 1)
         }
                                ).ToList()
     });
 }