public bool WestWallHasExit(Tile[,] aMap) { int width, height; width = aMap.GetLength(0); height = aMap.GetLength(1); for (int i = 0; i < height; i++) { if (aMap[0, i].MyWalls.HasFlag(TheWalls.End)) { return true; } } return false; }
public void TestOuterWalls(Tile[,] aMap) { int width, height, leftWall = 50, rightWall = 50, topWall = 50, bottomWall = 50; width = aMap.GetLength(0); height = aMap.GetLength(1); // determine where the exit is if (NorthWallHasExit(aMap)) { topWall = 1; } else { topWall = 0; } if (SouthWallHasExit(aMap)) { bottomWall = height - 2; } else { bottomWall = height - 1; } if (WestWallHasExit(aMap)) { leftWall = 1; } else { leftWall = 0; } if (EastWallHasExit(aMap)) { rightWall = width - 2; } else { rightWall = width - 1; } string corners = ""; corners += "Top: " + topWall.ToString() + "\nBottom: " + bottomWall.ToString() + "\nLeft: " + leftWall.ToString() + "\nRight: " + rightWall.ToString(); Console.WriteLine(corners); }
public int[] GetOuterWallArray(Tile[,] aMap) { int width, height, leftWall = 50, rightWall = 50, topWall = 50, bottomWall = 50; width = aMap.GetLength(0); height = aMap.GetLength(1); int[] theWallArray = new int[4]; // determine where the exit is if (NorthWallHasExit(aMap)) { topWall = 1; } else { topWall = 0; } if (SouthWallHasExit(aMap)) { bottomWall = height - 2; } else { bottomWall = height - 1; } if (WestWallHasExit(aMap)) { leftWall = 1; } else { leftWall = 0; } if (EastWallHasExit(aMap)) { rightWall = width - 2; } else { rightWall = width - 1; } string corners = ""; corners += "Top: " + topWall.ToString() + "\nBottom: " + bottomWall.ToString() + "\nLeft: " + leftWall.ToString() + "\nRight: " + rightWall.ToString(); Console.WriteLine(corners); theWallArray[0] = topWall; theWallArray[1] = rightWall; theWallArray[2] = bottomWall; theWallArray[3] = leftWall; return theWallArray; }
public bool SouthWallHasExit(Tile[,] aMap) { int width, height; width = aMap.GetLength(0); height = aMap.GetLength(1); for (int i = 0; i < width; i++) { if (aMap[i, (height - 1)].MyWalls.HasFlag(TheWalls.End)) { return true; } } return false; }
public bool HasExitTile(Tile[,] aMap) { for (int x = 0; x < aMap.GetLength(0); x++) { for (int y = 0; y < aMap.GetLength(1); y++) { if (aMap[x, y].MyWalls.HasFlag(TheWalls.End)) { return true; } } } return false; }