示例#1
0
 public GraphNode GetParent(GraphNode node)
 {
     return(parents[node]);
 }
示例#2
0
 public bool HasPathTo(GraphNode node)
 {
     return(parents != null && parents.ContainsKey(node));
 }
示例#3
0
 public override bool Suitable(GraphNode node)
 {
     return(base.Suitable(node) && path.HasPathTo(node));
 }
示例#4
0
 /** May be called by graph nodes to get a special cost for some connections.
  * Nodes may call it when PathNode.flag2 is set to true, for example mesh nodes, which have
  * a very large area can be marked on the start and end nodes, this method will be called
  * to get the actual cost for moving from the start position to its neighbours instead
  * of as would otherwise be the case, from the start node's position to its neighbours.
  * The position of a node and the actual start point on the node can vary quite a lot.
  *
  * The default behaviour of this method is to return the previous cost of the connection,
  * essentiall making no change at all.
  *
  * This method should return the same regardless of the order of a and b.
  * That is f(a,b) == f(b,a) should hold.
  *
  * \param a Moving from this node
  * \param b Moving to this node
  * \param currentCost The cost of moving between the nodes. Return this value if there is no meaningful special cost to return.
  */
 internal virtual uint GetConnectionSpecialCost(GraphNode a, GraphNode b, uint currentCost)
 {
     return(currentCost);
 }
示例#5
0
 public static uint GetTraversalCost(Path path, GraphNode node)
 {
     return(path.GetTagPenalty((int)node.Tag) + node.Penalty);
 }
示例#6
0
 public static bool CanTraverse(Path path, GraphNode node)
 {
     return(node.Walkable && (path.enabledTags >> (int)node.Tag & 0x1) != 0);
 }