/// <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); }
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)); } }
public bool WouldChangeMazeFieldType(MazeCoordinate coordinate, MazeFieldType typeAfter) { return(mazefield[coordinate.X][coordinate.Y].type != typeAfter); }
public MazeTransformationStep SetMazeTypeOnPos(MazeCoordinate coordinate, MazeFieldType type) { return(SetMazeTypeOnPos(coordinate.X, coordinate.Y, type)); }
public bool IsCorridor(MazeCoordinate coordinate) { return(GetMazeTypeOnPos(coordinate) == MazeFieldType.Corridor); }
public MazeFieldType GetMazeTypeOnPos(MazeCoordinate coordinate) { return(GetMazeTypeOnPos(coordinate.X, coordinate.Y)); }