Example #1
0
        private void TryQueueNewTile(IPathNode pNewNode, PathLink pLink, AStarStack pNodesToVisit, IPathNode pGoal)
        {
            IPathNode previousNode = pLink.GetOtherNode(pNewNode);
            float     linkDistance = pLink.distance;
            float     newPathCost  = previousNode.pathCostHere + pNewNode.baseCost + linkDistance;

            if (pNewNode.linkLeadingHere == null || (pNewNode.pathCostHere > newPathCost))
            {
                pNewNode.distanceToGoal  = pNewNode.DistanceTo(pGoal) * 2f;
                pNewNode.pathCostHere    = newPathCost;
                pNewNode.linkLeadingHere = pLink;
                pNodesToVisit.Push(pNewNode);
            }
        }
Example #2
0
 public void RemoveLink(PathLink pLink)
 {
     links.Remove(pLink);
 }
Example #3
0
 public void AddLink(PathLink pLink)
 {
     links.Add(pLink);
 }