| | | 1 | | using System; |
| | | 2 | | |
| | | 3 | | namespace Trailblazer.Pathing; |
| | | 4 | | |
| | | 5 | | /// <summary> |
| | | 6 | | /// Provides extension methods for debugging and visualizing the layout of a TraversalAuthoringMap. |
| | | 7 | | /// </summary> |
| | | 8 | | public static class TraversalAuthoringMapExtensions |
| | | 9 | | { |
| | | 10 | | /// <summary> |
| | | 11 | | /// Prints the token layout of a specific XZ plane in the source map for debugging purposes. |
| | | 12 | | /// </summary> |
| | | 13 | | /// <param name="map">The traversal authoring map to print.</param> |
| | | 14 | | /// <param name="yLevel">The Y level of the XZ plane to print.</param> |
| | | 15 | | /// <exception cref="ArgumentOutOfRangeException">Thrown if the specified Y level is out of bounds.</exception> |
| | | 16 | | public static void PrintXZPlane(this TraversalAuthoringMap map, int yLevel) |
| | | 17 | | { |
| | 2 | 18 | | int minY = 0; |
| | 2 | 19 | | int maxYExclusive = map.SourceMap.GetLength(0); |
| | 2 | 20 | | if (yLevel < minY || yLevel >= maxYExclusive) |
| | 1 | 21 | | throw new ArgumentOutOfRangeException(nameof(yLevel)); |
| | | 22 | | |
| | 1 | 23 | | Console.WriteLine($"Token XZ Plane at Y={yLevel} for Traversal Authoring Map [{map.ChartName}]:"); |
| | | 24 | | |
| | 1 | 25 | | int sizeX = map.SourceMap.GetLength(1); |
| | 1 | 26 | | int sizeZ = map.SourceMap.GetLength(2); |
| | 6 | 27 | | for (int z = 0; z < sizeZ; z++) |
| | | 28 | | { |
| | 12 | 29 | | for (int x = 0; x < sizeX; x++) |
| | | 30 | | { |
| | 4 | 31 | | string token = map.SourceMap[yLevel, x, z]; |
| | 4 | 32 | | Console.Write(string.IsNullOrWhiteSpace(token) ? ". " : $"{token} "); |
| | | 33 | | } |
| | | 34 | | |
| | 2 | 35 | | Console.WriteLine(); |
| | | 36 | | } |
| | 1 | 37 | | } |
| | | 38 | | } |