Function ITraversalProvider.GetConnectionCost

GetConnectionCost (refTraversalCosts traversalCosts, GraphNode from, GraphNode to)

Cost of entering a given node from another node.

Public
uint GetConnectionCost (

refTraversalCosts

traversalCosts

GraphNode

from

GraphNode

to

)

Cost of entering a given node from another node.

Should return the additional cost for moving between from and to. By default, if no tags or penalties are used, then the connection cost is zero. A cost of 1000 corresponds roughly to the cost of moving 1 world unit.

This cost is not scaled by the distance between the two nodes. This cost is also not affected by the traversal cost multiplier.

The default implementation returns 0, and all cost comes from the GetTraversalCostMultiplier method instead.

public uint GetConnectionCost (ref TraversalCosts traversalCosts, GraphNode from, GraphNode to) {
// The traversal cost is, by default, the sum of the penalty of the node's tag and the node's penalty
return traversalCosts.GetTagEntryCost(to.Tag) + to.Penalty;
// alternatively:
// return DefaultITraversalProvider.GetConnectionCost(ref traversalCosts, from, to);
}