public override string ToString() { if (!this.mySerialized) { for (int i = 0; i < TransitCells.Count; i++) { this.mySerializedPath.Append(Pathfinder.GetDirectionChar(Directions[i])); this.mySerializedPath.Append(CellHelper.CellIdToCharCode(TransitCells[i])); } this.mySerialized = true; } return(this.mySerializedPath.ToString()); }
public static MovementPath DecodePath(Map Map, int CurrentCell, string Path) { MovementPath MovementPath = new MovementPath(); MovementPath.AddCell(CurrentCell, GetDirection(Map, CurrentCell, CellHelper.CellCharCodeToId(Path.Substring(1, 2)))); for (int i = 0; i < Path.Length; i += 3) { int curCell = CellHelper.CellCharCodeToId(Path.Substring(i + 1, 2)); int curDir = CellHelper.HASH.IndexOf(Path[i]); MovementPath.AddCell(curCell, curDir); } return(MovementPath); }