public bool CollisionTest_Right_IsCompatable(RandomizerModWorldScreen destinationWS) { if (ScreenIndexRight == 0xFF) { return(true); } //take the edge of this screen's grid, and compare it to the opposite edge of the destinationWS Tile[,] tileGrid = GetTileGrid(); Tile[,] destinationTileGrid = destinationWS.GetTileGrid(); Tile[] tileGrid_RightEdge = new Tile[6]; for (int y = 0; y < tileGrid.GetLength(1); y++) { tileGrid_RightEdge[y] = tileGrid[7, y]; } Tile[] destinationTileGrid_LeftEdge = new Tile[6]; for (int y = 0; y < tileGrid.GetLength(1); y++) { destinationTileGrid_LeftEdge[y] = destinationTileGrid[0, y]; } bool[] compatableCollisionTiles = new bool[6]; for (int y = 0; y < tileGrid.GetLength(1); y++) { if (TileIsWalkable(tileGrid_RightEdge[y]) == TileIsWalkable(destinationTileGrid_LeftEdge[y])) { compatableCollisionTiles[y] = true; } } //Now we have a bool array indicating which squares are compatable with the other screen. Use this to decide if the screens are compatable return(AllBoolsAreTrue(compatableCollisionTiles)); }
public bool CollisionTest_Down_IsCompatable(RandomizerModWorldScreen destinationWS) { if (ScreenIndexDown == 0xFF) { return(true); } //take the edge of this screen's grid, and compare it to the opposite edge of the destinationWS Tile[,] tileGrid = GetTileGrid(); Tile[,] destinationTileGrid = destinationWS.GetTileGrid(); Tile[] tileGrid_BottomEdge = new Tile[8]; for (int x = 0; x < tileGrid.GetLength(0); x++) { tileGrid_BottomEdge[x] = tileGrid[x, 5]; } Tile[] destinationTileGrid_TopEdge = new Tile[8]; for (int x = 0; x < tileGrid.GetLength(0); x++) { destinationTileGrid_TopEdge[x] = destinationTileGrid[x, 0]; } bool[] compatableCollisionTiles = new bool[8]; for (int x = 0; x < tileGrid.GetLength(0); x++) { if (TileIsWalkable(tileGrid_BottomEdge[x]) == TileIsWalkable(destinationTileGrid_TopEdge[x])) { compatableCollisionTiles[x] = true; } } //Now we have a bool array indicating which squares are compatable with the other screen. Use this to decide if the screens are compatable return(AllBoolsAreTrue(compatableCollisionTiles)); }