public override Fix64 CalculateH(BaseAStarNode <PNavPolygon> other) { NavMeshAStarNode otherNode = (NavMeshAStarNode)other; if (otherNode.isLastNode) { return(Fix64Vec2.Distance(startPoint, otherNode.endPoint)); } else { return(Fix64Vec2.Distance(startPoint, otherNode.UserObject.centroid)); } //Fix64 result = Fix64Vec2.Distance(UserObject.centroid, other.UserObject.centroid); //if (other) //return result; }
public override Fix64 CalculateG(BaseAStarNode <PNavPolygon> other) { NavMeshAStarNode otherNode = (NavMeshAStarNode)other; Fix64 result = Fix64.zero; foreach (PNavEdge edge in other.UserObject.edges) { if (edge.hasOther && edge.otherPolygonIndex == UserObject.index) { result = Fix64Vec2.DistanceToSegment(startPoint, edge.pointA, edge.pointB, out otherNode.startPoint); if (otherNode.isLastNode) { result = result + Fix64Vec2.Distance(otherNode.endPoint, otherNode.startPoint); } //result = edge.distance; } } return(result); }
public abstract Fix64 CalculateH(BaseAStarNode <T> other);
public abstract bool Equals(BaseAStarNode <T> other);
public override bool Equals(BaseAStarNode <PNavPolygon> other) { return(UserObject.index == other.UserObject.index); }