Example #1
0
        /// <summary>
        /// Determines if the coordinate is within the maze walls.
        /// </summary>
        /// <returns>Returns true if point is inside the maze. Returns false when outside or directly on the outer wall.</returns>
        internal bool IsPointInMaze(MazeCoordinate point)
        {
            // Out of the maze?
            if (point.X <= 0 || point.X >= width - 1)
            {
                return(false);
            }

            if (point.Y >= height - 1 || point.Y <= 0)
            {
                return(false);
            }

            return(true);
        }
Example #2
0
        internal IEnumerable <MazeTransformationStep> MakeRectangle(MazeCoordinate upperleft, MazeCoordinate downright, MazeFieldType defaultType = MazeFieldType.Wall)
        {
            int i;

            for (i = 0; i < this.height; i++)
            { // Left / Right walls
                yield return(this.SetMazeTypeOnPos(upperleft.X, upperleft.Y - i, defaultType));

                yield return(this.SetMazeTypeOnPos(downright.X, upperleft.Y - i, defaultType));
            }

            for (i = 0; i < this.width; i++)
            { // Top / Bottom walls
                yield return(this.SetMazeTypeOnPos(upperleft.X + i, upperleft.Y, defaultType));

                yield return(this.SetMazeTypeOnPos(upperleft.X + i, downright.Y, defaultType));
            }
        }
Example #3
0
 public bool WouldChangeMazeFieldType(MazeCoordinate coordinate, MazeFieldType typeAfter)
 {
     return(mazefield[coordinate.X][coordinate.Y].type != typeAfter);
 }
Example #4
0
 public MazeTransformationStep SetMazeTypeOnPos(MazeCoordinate coordinate, MazeFieldType type)
 {
     return(SetMazeTypeOnPos(coordinate.X, coordinate.Y, type));
 }
Example #5
0
 public bool IsCorridor(MazeCoordinate coordinate)
 {
     return(GetMazeTypeOnPos(coordinate) == MazeFieldType.Corridor);
 }
Example #6
0
 public MazeFieldType GetMazeTypeOnPos(MazeCoordinate coordinate)
 {
     return(GetMazeTypeOnPos(coordinate.X, coordinate.Y));
 }