コード例 #1
0
ファイル: MovementPath.cs プロジェクト: 745c5412/tera-emu
        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);
        }