public void RemoveConnectedWaypoint(PathfindWaypoint p) { if (connectedWaypoints.ContainsKey(p)) { connectedWaypoints.Remove(p); p.RemoveConnectedWaypoint(this); } }
public void ConnectWaypoints(PathfindWaypoint otherWaypoint) { if (!connectedWaypoints.ContainsKey(otherWaypoint)) { connectedWaypoints.Add(otherWaypoint, GetDistanceTo(otherWaypoint.Position)); otherWaypoint.ConnectWaypoints(this); } }
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(); }