Ejemplo n.º 1
0
 public void OverrideAllMazeFields(MazeFieldType defaultType = MazeFieldType.Corridor)
 {
     for (int w = 0; w < width; w++)
     {
         for (int h = 0; h < height; h++)
         {
             mazefield[w][h].type = defaultType;
         }
     }
 }
Ejemplo n.º 2
0
        public MazeTransformationStep SetMazeTypeOnPos(int x, int y, MazeFieldType type)
        {
            var step = new MazeTransformationStep()
            {
                coordinate = new MazeCoordinate()
                {
                    X = x, Y = y
                }, typeAfterTransform = type
            };

            mazefield[x][y].type = type;
            this.drawCallback?.Invoke(step);

            return(step);
        }
Ejemplo n.º 3
0
 public bool WouldChangeMazeFieldType(MazeCoordinate coordinate, MazeFieldType typeAfter)
 {
     return(mazefield[coordinate.X][coordinate.Y].type != typeAfter);
 }
Ejemplo n.º 4
0
 public bool WouldChangeMazeFieldType(int x, int y, MazeFieldType typeAfter)
 {
     return(mazefield[x][y].type != typeAfter);
 }
Ejemplo n.º 5
0
 public MazeTransformationStep SetMazeTypeOnPos(MazeCoordinate coordinate, MazeFieldType type)
 {
     return(SetMazeTypeOnPos(coordinate.X, coordinate.Y, type));
 }
Ejemplo n.º 6
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));
            }
        }