예제 #1
0
        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());
        }
예제 #2
0
        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);
        }