예제 #1
0
        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;
        }
예제 #2
0
        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);
        }
예제 #3
0
 public abstract Fix64 CalculateH(BaseAStarNode <T> other);
예제 #4
0
 public abstract bool Equals(BaseAStarNode <T> other);
예제 #5
0
 public override bool Equals(BaseAStarNode <PNavPolygon> other)
 {
     return(UserObject.index == other.UserObject.index);
 }