示例#1
0
 public void RemoveConnectedWaypoint(PathfindWaypoint p)
 {
     if (connectedWaypoints.ContainsKey(p))
     {
         connectedWaypoints.Remove(p);
         p.RemoveConnectedWaypoint(this);
     }
 }
示例#2
0
 public void ConnectWaypoints(PathfindWaypoint otherWaypoint)
 {
     if (!connectedWaypoints.ContainsKey(otherWaypoint))
     {
         connectedWaypoints.Add(otherWaypoint, GetDistanceTo(otherWaypoint.Position));
         otherWaypoint.ConnectWaypoints(this);
     }
 }
示例#3
0
        public PathfindWaypoint Copy()
        {
            PathfindWaypoint result = new PathfindWaypoint(position);

            foreach (KeyValuePair <PathfindWaypoint, double> way in connectedWaypoints)
            {
                result.connectedWaypoints.Add(way.Key, way.Value);
            }

            return(result);
        }
        public PathfindNode(PathfindWaypoint owningWaypoint, PathfindNode parentNode, double distanceFromParent, Vector3 destination)
        {
            position = owningWaypoint.Position;
            parent   = parentNode;
            owner    = owningWaypoint;

            defaultG = distanceFromParent;

            h = GetDistanceTo(destination);
            CalculateFitness();
        }