Beispiel #1
0
        /// <summary>
        /// Distance (en pm) (manhatann)
        /// </summary>
        /// <param name="originCellId"></param>
        /// <param name="destinationCellId"></param>
        /// <returns></returns>
        public static short GetDistanceBetween(short originCellId, short destinationCellId)
        {
            CoordCells.CellData originCell      = CoordCells.GetCell(originCellId);
            CoordCells.CellData destinationCell = CoordCells.GetCell(destinationCellId);
            int diffX = Math.Abs(originCell.X - destinationCell.X);
            int diffY = Math.Abs(originCell.Y - destinationCell.Y);

            return((short)(diffX + diffY));
        }
Beispiel #2
0
        public static List <Node> GetNodes(MapRecord map)
        {
            var nodes = new List <Node>();

            for (short cell = 0; cell < 560; cell++)
            {
                var node = new Node(CoordCells.GetCell(cell));
                node.Walkable = map.Walkable((ushort)cell);
                nodes.Add(node);
            }
            return(nodes);
        }