Пример #1
0
 public LinkedList<IPathNode> GetRouteFromTo(int startIdx, int endIdx)
 {
     LinkedList<IPathNode> nodeList = new LinkedList<IPathNode>();
     if (m_pathFinding.IsComputing)
     {
         Debug.LogWarning("PathFinding is already computing. GetRouteFromTo will not be executed!");
     }
     else
     {                
         IPathNode start = GetMapTileNode(startIdx);
         EndNode = GetMapTileNode(endIdx);
         nodeList = m_pathFinding.ComputePath(start, EndNode);
     }
     return nodeList;
 }
Пример #2
0
        /// <summary>
        /// Return a list of path nodes from the start tile to the end tile ( Use RpgMapHelper class to get the tile index )
        /// </summary>
        /// <param name="startIdx"></param>
        /// <param name="endIdx"></param>
        /// <returns></returns>
        public LinkedList <IPathNode> GetRouteFromTo(Vector2 startPos, Vector2 endPos)
        {
            LinkedList <IPathNode> nodeList = new LinkedList <IPathNode>();

            if (m_pathFinding.IsComputing)
            {
                Debug.LogWarning("PathFinding is already computing. GetRouteFromTo will not be executed!");
            }
            else
            {
                IPathNode start = GetMapTileNode(startPos);
                EndNode  = GetMapTileNode(endPos);
                nodeList = m_pathFinding.ComputePath(start, EndNode, AllowBlockedDestination);         //NOTE: the path is given from end to start ( change the order? )
            }
            return(nodeList);
        }
Пример #3
0
        /// <summary>
        /// Return a list of path nodes from the start tile to the end tile ( Use RpgMapHelper class to get the tile index )
        /// </summary>
        /// <param name="startIdx"></param>
        /// <param name="endIdx"></param>
        /// <returns></returns>
        public LinkedList <IPathNode> GetRouteFromTo(int startIdx, int endIdx)
        {
            LinkedList <IPathNode> nodeList = new LinkedList <IPathNode>();

            if (m_pathFinding.IsComputing)
            {
                Debug.LogWarning("PathFinding is already computing. GetRouteFromTo will not be executed!");
            }
            else
            {
                IPathNode start = GetMapTileNode(startIdx);
                EndNode  = GetMapTileNode(endIdx);
                nodeList = m_pathFinding.ComputePath(start, EndNode);         //NOTE: the path is given from end to start ( change the order? )
            }
            return(nodeList);
        }