/* * For pathfinding purposes, get two waypoints from road */ public override Vector2[] GetWaypoints(PathfindingObject previousObject, PathfindingObject nextObject) { Vector2 upRight, downLeft, middle; if (trafficDirection.x != 0) // horizontal { upRight.y = GetPositionCenter2().y; downLeft.y = GetPositionCenter2().y; upRight.x = GridHelper.GetWorldPosition2(grid_position_max).x; downLeft.x = GridHelper.GetWorldPosition2(grid_position_min).x; } else if (trafficDirection.y != 0) // vertical { upRight.x = GetPositionCenter2().x; downLeft.x = GetPositionCenter2().x; upRight.y = GridHelper.GetWorldPosition2(grid_position_max).y; downLeft.y = GridHelper.GetWorldPosition2(grid_position_min).y; } else { upRight = Vector2.zero; downLeft = Vector2.zero; print("fatal error, shouldn't go here!"); } middle = GetPositionCenter2(); // create array to return and get world position from previous object Vector2[] returnArray = new Vector2[2]; Vector2 previousWorldPosition2 = previousObject.GetPositionCenter2(); // determine which waypoint is closer, put that first in array if (Vector2.Distance(previousWorldPosition2, upRight) < Vector2.Distance(previousWorldPosition2, downLeft)) // if right side is closer, put it first { returnArray[0] = upRight; returnArray[1] = downLeft; } else { returnArray[0] = downLeft; returnArray[1] = upRight; } // if road length is less than width, remove middle array if (GetRoadWidth() + 2 < GetRoadLength()) { Vector2[] tempArray = new Vector2[3]; tempArray[0] = returnArray[0]; tempArray[2] = returnArray[1]; tempArray[1] = middle; return(tempArray); } return(returnArray); }
// -------------------------------- for pathfinding -------------------------------- public override PathfindingObject[] GetNeighbours() { PathfindingObject[] returnArray = new PathfindingObject[roadConnections.Count]; for (int i = 0; i < roadConnections.Count; i++) { returnArray[i] = roadConnections[i]; } return returnArray; }
public override void Visit(PathfindingObject startObject, PathfindingObject endObject) { objectPath = RoadPathfinding.CreatePath(startObject, endObject); if (objectPath == null) { Debug.Log("Can't visit because path cannot be found!"); return; } // -- create list from object path, all at once // in the future this will have to be REPLACED because road might disappear. // So instead it would search by getting waypoints from PathfindingObjects as // the vehicle went along, so if a road disappears, we could reroute Vector2[] position_waypoints = new Vector2[objectPath.Length * 2]; int vectorIndex = 0; for (int index = 0; index < objectPath.Length; index++) { Vector2[] temp_waypoints = new Vector2[0]; // if not first or last if (index != 0 && index != (objectPath.Length - 1)) { temp_waypoints = objectPath[index].GetWaypoints(objectPath[index - 1], objectPath[index + 1]); } else if (index == 0) // if first { temp_waypoints = new Vector2[1]; temp_waypoints[0] = objectPath[index].GetWaypoint(); } // do nothing if first // loop list from pathfindingObject and add to list for (int k = 0; k < temp_waypoints.Length; k++) { position_waypoints[vectorIndex] = temp_waypoints[k]; vectorIndex++; } } path = Helper.ResizeArray(position_waypoints, vectorIndex); // --------------------------------------- PathIndex = path.Length - 1; movingEntity.targetPos = path[PathIndex]; steeringCalculate.seek = true; // set distance for visiting; when path moves on to next waypoint pathfindingCellDelta = GridHelper.GetGridCellSize(); //Debug.Log("path index = " + PathIndex); }
// -------------------------------- for pathfinding -------------------------------- public override PathfindingObject[] GetNeighbours() { PathfindingObject[] returnArray = new PathfindingObject[roadConnections.Count]; for (int i = 0; i < roadConnections.Count; i++) { returnArray[i] = roadConnections[i]; } return(returnArray); }
// -------------------------------- for pathfinding -------------------------------- public override PathfindingObject[] GetNeighbours() { PathfindingObject[] returnArray = new PathfindingObject[4]; returnArray[0] = topConnection; returnArray[1] = rightConnection; returnArray[2] = bottomConnection; returnArray[3] = leftConnection; return(returnArray); }
/* * Is it possible to travel from @param pathObject to any of the * runways? */ bool AreRunwaysReachable(PathfindingObject pathObject) { foreach(Runway runway in airport.runwayList) { PathfindingObject[] path = RoadPathfinding.CreatePath (pathObject, runway); if (path != null) { return true; } } return false; }
// // //function GetPathLength(curNode : Node) : int { // if (curNode.fakeParent == null) { // return 0; // } else { // return 1 + GetPathLength(curNode.fakeParent); // } //} // /** * Generic return path function */ static Vector2[] GeneratePath(PathfindingObject endObject, Dictionary <int, PathfindingObject> openList) { int index = 0; PathfindingObject curObject = endObject; bool loopEnabled = true; Vector3[] waypoints = new Vector3[1024]; // add position of first cell, then look if that cell has a fakeParent // if so, increase index and add in next loop to list // otherwise, stop loop while (loopEnabled) { //print ("index = " + index + " and size = " + openList.Count); waypoints[index] = curObject.GetPositionCenter(); if (curObject.HasFakeParent()) { curObject = curObject.GetFakeParent(); index++; } else { loopEnabled = false; } // while loop protection if (index > 999999) { loopEnabled = false; print("while loop crash"); } } // create returnable list with correct size and add end position at start Vector2[] return_waypoints = new Vector2[index + 1]; //return_waypoints [0] = new Vector2(endPosition.x, endPosition.z); for (int i = 0; i < return_waypoints.Length; i++) { return_waypoints[i] = new Vector2(waypoints[i].x, waypoints[i].z); } if (debugging) { //DrawPath(return_waypoints, 0.2f); } return(return_waypoints); }
/* * Is it possible to travel from @param pathObject to any of the * runways? */ bool AreRunwaysReachable(PathfindingObject pathObject) { foreach (Runway runway in airport.runwayList) { PathfindingObject[] path = RoadPathfinding.CreatePath(pathObject, runway); if (path != null) { return(true); } } return(false); }
public override void Visit(PathfindingObject startObject, PathfindingObject endObject) { objectPath = RoadPathfinding.CreatePath(startObject, endObject); if (objectPath == null) { Debug.Log("Can't visit because path cannot be found!"); return; } // -- create list from object path, all at once // in the future this will have to be REPLACED because road might disappear. // So instead it would search by getting waypoints from PathfindingObjects as // the vehicle went along, so if a road disappears, we could reroute Vector2[] position_waypoints = new Vector2[objectPath.Length * 2]; int vectorIndex = 0; for (int index = 0; index < objectPath.Length; index++) { Vector2[] temp_waypoints = new Vector2[0]; // if not first or last if (index != 0 && index != (objectPath.Length - 1)) temp_waypoints = objectPath[index].GetWaypoints(objectPath[index - 1], objectPath[index + 1]); else if (index == 0) { // if first temp_waypoints = new Vector2[1]; temp_waypoints[0] = objectPath[index].GetWaypoint(); } // do nothing if first // loop list from pathfindingObject and add to list for (int k = 0; k < temp_waypoints.Length; k++) { position_waypoints[vectorIndex] = temp_waypoints[k]; vectorIndex++; } } path = Helper.ResizeArray(position_waypoints, vectorIndex); // --------------------------------------- PathIndex = path.Length - 1; movingEntity.targetPos = path[PathIndex]; steeringCalculate.seek = true; // set distance for visiting; when path moves on to next waypoint pathfindingCellDelta = GridHelper.GetGridCellSize(); //Debug.Log("path index = " + PathIndex); }
/** * Called by CreatePath to calculate H value for given gridCell * */ static float CalculateH(PathfindingObject curObject, PathfindingObject endObject) { Vector2 curPos, endPos; curPos = curObject.GetPositionCenter2(); // THIS SHOULD probably be array position endPos = endObject.GetPositionCenter2(); // THIS SHOULD probably be array position Vector2 calculateHDistance = new Vector2(Mathf.Abs(curPos.x - endPos.x), Mathf.Abs(curPos.y - endPos.y)); // float newH = ((calculateHDistance.x / grid.sizeGridX) * HORIZONTAL_VERTICAL_COST) + ((calculateHDistance.y / grid.sizeGridX) * HORIZONTAL_VERTICAL_COST); MIGHT NEEED THIS!!!!!!!!! float newH = (calculateHDistance.x * HORIZONTAL_VERTICAL_COST) + (calculateHDistance.y * HORIZONTAL_VERTICAL_COST); curObject.SetHCost(newH); return(newH); }
/** * Called by CreatePath to return adjacent cells * * Only return cells that are empty are not in */ static PathfindingObject[] ReturnAdjacentNodes(PathfindingObject cur_pf_object, Dictionary <int, PathfindingObject> closedList, Dictionary <int, PathfindingObject> openList) { PathfindingObject[] adjacentObjects = cur_pf_object.GetNeighbours(); PathfindingObject[] returnList = new PathfindingObject[adjacentObjects.Length]; int index = 0; for (var x = 0; x < adjacentObjects.Length; x++) { try { // check if in closed list if (closedList.ContainsKey(adjacentObjects[x].GetID())) { // do nothing // check if in open list } else if (openList.ContainsKey(adjacentObjects[x].GetID())) { // check if g cost can be lower // take g with original parent, save old parent float originalG = CalculateG(adjacentObjects[x]); PathfindingObject oldParent = adjacentObjects[x].GetFakeParent(); // change parent to check if new one works better adjacentObjects[x].SetFakeParent(cur_pf_object); if (originalG < CalculateG(adjacentObjects[x])) // if cost of G is higher after switching parent { adjacentObjects[x].SetFakeParent(oldParent); // then switch it back } // otherwise add to returnable list } else { returnList[index] = adjacentObjects[x]; index++; } } catch { } } return(returnList); }
/* * Test if all the conditions are verified so that passengers and airplanes can be spawned * in the form of a Flight being created */ bool ReadyForFlightCreation(PathfindingObject pathObject, FutureFlight futureFlight) { // test if the parking spot has a road connection if (!futureFlight.parkingSpot.HasRoadConnection()) { return(false); } // test if runways are reachable else if (!AreRunwaysReachable(futureFlight.parkingSpot)) { return(false); } // test if there are entrances else if (airport.GetAllEntrances().Count < 1) { return(false); } return(true); }
static float CalculateG(PathfindingObject curObject) { float newG; if (!curObject.HasFakeParent()) // gridCell.ultimateParent { print("problems!!!"); return(-999); // if there is a parent } else { // check if connection is straight or diagonal (ID's because of performance issues) newG = (HORIZONTAL_VERTICAL_COST * curObject.GetGCostMultiplier()) + curObject.GetFakeParent().GetGCost(); curObject.SetGCost(newG); return(newG); } }
static PathfindingObject GetLowestF(PathfindingObject endObject, Dictionary <int, PathfindingObject> openList) { PathfindingObject lowestFObject = null; float lowestF = -1f; // calculate G, H and thus F for all openList gridCells for (var obj = openList.GetEnumerator(); obj.MoveNext();) { // first one if (lowestF == -1f) { lowestF = CalculateG(obj.Current.Value) + CalculateH(obj.Current.Value, endObject); lowestFObject = obj.Current.Value; } else if (CalculateG(obj.Current.Value) + CalculateH(obj.Current.Value, endObject) < lowestF) { lowestF = CalculateG(obj.Current.Value) + CalculateH(obj.Current.Value, endObject); lowestFObject = obj.Current.Value; } } return(lowestFObject); }
static PathfindingObject[] GenerateRoadPath(PathfindingObject endObject, Dictionary <int, PathfindingObject> openList) { int index = 0; PathfindingObject curObject = endObject; bool loopEnabled = true; PathfindingObject[] waypoints = new PathfindingObject[1024]; // add position of first cell, then look if that cell has a fakeParent // if so, increase index and add in next loop to list // otherwise, stop loop while (loopEnabled) { //print ("index = " + index + " and size = " + openList.Count); waypoints[index] = curObject; if (curObject.HasFakeParent()) { curObject = curObject.GetFakeParent(); index++; } else { loopEnabled = false; } // while loop protection if (index > 999999) { loopEnabled = false; print("while loop crash"); } } // create returnable list with correct size and add end position at start PathfindingObject[] return_waypoints = new PathfindingObject[index + 1]; for (int i = 0; i < return_waypoints.Length; i++) { return_waypoints[i] = waypoints[i]; } // now create new list with all the Vector3 waypoints Vector2[] position_waypoints = new Vector2[return_waypoints.Length * 2]; int vectorIndex = 0; for (index = 0; index < return_waypoints.Length; index++) { Vector2[] temp_waypoints; // if not first or last if (index != 0 && index != (return_waypoints.Length - 1)) { temp_waypoints = return_waypoints[index].GetWaypoints(return_waypoints[index - 1], return_waypoints[index + 1]); } else // if first or last index { temp_waypoints = new Vector2[1]; temp_waypoints[0] = return_waypoints[index].GetWaypoint(); } // loop list from pathfindingObject and add to list for (int k = 0; k < temp_waypoints.Length; k++) { position_waypoints[vectorIndex] = temp_waypoints[k]; vectorIndex++; } } position_waypoints = Helper.ResizeArray(position_waypoints, vectorIndex); if (debugging) { DrawPath(position_waypoints, 0.2f); } return(return_waypoints); }
public virtual void Visit(PathfindingObject startObject, PathfindingObject endObject) { Debug.Log("Not implemented!"); }
// -------------------------------- for pathfinding -------------------------------- public override PathfindingObject[] GetNeighbours() { PathfindingObject[] returnArray = new PathfindingObject[4]; returnArray[0] = topConnection; returnArray[1] = rightConnection; returnArray[2] = bottomConnection; returnArray[3] = leftConnection; return returnArray; }
void UpdateConnectionsHorizontal() { //print(this.gameObject.name + " is updating horizontal connections"); // begin swith saving road at start of loop Road foundRoadRight = GridHelper.GetGridCell(grid_position_max.x + 1, grid_position_min.y).GetRoad(); Road foundRoadLeft = GridHelper.GetGridCell(grid_position_min.x - 1, grid_position_min.y).GetRoad(); // also parking PathfindingObject foundGridObjectRight = GridHelper.GetGridCell(grid_position_max.x + 1, grid_position_min.y).GetPathfindingObject(); PathfindingObject foundGridObjectLeft = GridHelper.GetGridCell(grid_position_min.x - 1, grid_position_min.y).GetPathfindingObject(); // y loops same for left and right for (int loopY = (int)grid_position_min.y; loopY <= grid_position_max.y; loopY++) { // check right if (foundRoadRight != null) { if (foundRoadRight != GridHelper.GetGridCell(grid_position_max.x + 1, loopY).GetRoad()) { foundRoadRight = null; } } if (foundGridObjectRight != null) { if (foundGridObjectRight != GridHelper.GetGridCell(grid_position_max.x + 1, loopY).GetPathfindingObject()) { foundGridObjectRight = null; } } // check left if (foundRoadLeft != null) { if (foundRoadLeft != GridHelper.GetGridCell(grid_position_min.x - 1, loopY).GetRoad()) { foundRoadLeft = null; } } if (foundGridObjectLeft != null) { if (foundGridObjectLeft != GridHelper.GetGridCell(grid_position_min.x - 1, loopY).GetPathfindingObject()) { foundGridObjectLeft = null; } } } // first update road connections rightConnection = foundRoadRight; leftConnection = foundRoadLeft; if (rightConnection is RoadCorner) { rightConnection.UpdateRoad(); } if (leftConnection is RoadCorner) { leftConnection.UpdateRoad(); } if (rightConnection != null) { rightConnection.SetConnection(this, new Vector2(1, 0)); } if (leftConnection != null) { leftConnection.SetConnection(this, new Vector2(-1, 0)); } // and also pathfinding objects (part of the road network) if (foundGridObjectRight != null) { PFObjectTopRight = foundGridObjectRight; PFObjectTopRight.SetRoadConnection(this); } if (foundGridObjectLeft != null) { PFObjectBottomLeft = foundGridObjectLeft; PFObjectBottomLeft.SetRoadConnection(this); } }
public static PathfindingObject[] CreatePath(PathfindingObject startObject, PathfindingObject endObject) { Dictionary <int, PathfindingObject> openDictionaryList = new Dictionary <int, PathfindingObject>(); Dictionary <int, PathfindingObject> closedDictionaryList = new Dictionary <int, PathfindingObject>(); PathfindingObject curObject = startObject; PathfindingObject[] adjacentObjects; // FIRST step, only one time ------------------------------------------------------------------------------------------------------// if (closedDictionaryList.Count == 0) { closedDictionaryList.Add(curObject.GetID(), curObject); // get adjacent roads adjacentObjects = ReturnAdjacentNodes(curObject, closedDictionaryList, openDictionaryList); // add to open list for (var i = 0; i < adjacentObjects.Length; i++) { if (adjacentObjects[i] != null) { // add all to open list openDictionaryList[adjacentObjects[i].GetID()] = adjacentObjects[i]; // parent to start point adjacentObjects[i].SetFakeParent(curObject); } } } if (debugging) { print("openList size: " + openDictionaryList.Count); print("closedList size: " + closedDictionaryList.Count); } // SECOND step, look for lowest F value in openList --------------------------------------------------------------------------------// // 1. Add gridCell this to closedList and remove from closedList. // 2. Get cells adjacent to lowest F value // * don't include ones in closed list. // * Check if they're already on open list, if so: // o don't include them but check if their G cost can be lower with currentCell with lowest F value) as parent. // * Get adjacent cells that remain and add them to openList. // 3. Then start all over again if we've not reached the target yet. bool loopingEnabled = true; bool searchingFailure = false; int loopCount = 0; // keep looping while curernt cell is not last one while (loopingEnabled && !searchingFailure) { // calculate the lowest F value and return corresponding gridCell curObject = GetLowestF(endObject, openDictionaryList); if (curObject == null) { searchingFailure = true; break; } if (curObject.GetID() != 0) { ; } if (closedDictionaryList.ContainsKey(curObject.GetID())) { // don't add } else { // add closedDictionaryList.Add(curObject.GetID(), curObject); // remove from open list openDictionaryList.Remove(curObject.GetID()); } // get adjecent cells adjacentObjects = ReturnAdjacentNodes(curObject, closedDictionaryList, openDictionaryList); // add to open list for (int j = 0; j < 8; j++) { // if (adjacentCells[j]) { NEEED TO DO NULL CHEEECK try { // add all to open list openDictionaryList[adjacentObjects[j].GetID()] = adjacentObjects[j]; // parent to current cell adjacentObjects[j].SetFakeParent(curObject); } catch { } // } } // see if we can leave loop ?? if (curObject.GetID() == endObject.GetID()) { loopingEnabled = false; } if (loopCount >= 10000) { // can't find path print("pathfinding can't find path"); loopingEnabled = false; return(null); } // print ("openList size: " + openDictionaryList.Count); // print ("closedList size: " + closedDictionaryList.Count); loopCount++; } if (searchingFailure) { //print("search failure"); return(null); } PathfindingObject[] returnRoadPath = GenerateRoadPath(curObject, openDictionaryList); ResetPathfinding(openDictionaryList, closedDictionaryList); return(returnRoadPath); }
void UpdateConnectionsVertical() { //print(this.gameObject.name + " is updating vertical connections"); // reset for up and down Road foundRoadUp = GridHelper.GetGridCell(grid_position_min.x, grid_position_max.y + 1).GetRoad(); Road foundRoadDown = GridHelper.GetGridCell(grid_position_min.x, grid_position_min.y - 1).GetRoad(); // also look for parking spots PathfindingObject foundGridObjectUp = GridHelper.GetGridCell(grid_position_min.x, grid_position_max.y + 1).GetPathfindingObject(); PathfindingObject foundGridObjectDown = GridHelper.GetGridCell(grid_position_min.x, grid_position_min.y - 1).GetPathfindingObject(); // x loops same for up and down for (int loopX = (int)grid_position_min.x; loopX <= grid_position_max.x; loopX++) { // check up if (foundRoadUp != null) { if (foundRoadUp != GridHelper.GetGridCell(loopX, grid_position_max.y + 1).GetRoad()) { foundRoadUp = null; } if (foundGridObjectUp != null) { if (foundGridObjectUp != GridHelper.GetGridCell(loopX, grid_position_max.y + 1).GetPathfindingObject()) { foundGridObjectUp = null; } } // check down if (foundRoadDown != null) { if (foundRoadDown != GridHelper.GetGridCell(loopX, grid_position_min.y - 1).GetRoad()) { foundRoadDown = null; } } if (foundGridObjectDown != null) { if (foundGridObjectDown != GridHelper.GetGridCell(loopX, grid_position_min.y - 1).GetPathfindingObject()) { foundGridObjectDown = null; } } } //print("UP - look at cells: " + loopX + ", " + (grid_position_max.y + 1)); //print("DOWN - look at cells: " + loopX + ", " + (grid_position_min.y - 1)); } // uprdate road connections topConnection = foundRoadUp; bottomConnection = foundRoadDown; if (topConnection is RoadCorner) { topConnection.UpdateRoad(); } if (bottomConnection is RoadCorner) { bottomConnection.UpdateRoad(); } if (topConnection != null) { topConnection.SetConnection(this, new Vector2(0, 1)); } if (bottomConnection != null) { bottomConnection.SetConnection(this, new Vector2(0, -1)); } // and also pathfinding objects (part of the road network) if (foundGridObjectUp != null) { PFObjectTopRight = foundGridObjectUp; PFObjectTopRight.SetRoadConnection(this); } if (foundGridObjectDown != null) { PFObjectBottomLeft = foundGridObjectDown; PFObjectBottomLeft.SetRoadConnection(this); } }
public void SetFakeParent(PathfindingObject pf_object) { fakeParent = pf_object; }
public virtual Vector2[] GetWaypoints(PathfindingObject previousObject, PathfindingObject nextObject) { Vector2[] returnArray= new Vector2[1]; returnArray[0] = GetPositionCenter2(); return returnArray; }
public override Vector2[] GetWaypoints(PathfindingObject previousObject, PathfindingObject nextObject) { return(new Vector2[0]);; }
public override Vector2[] GetWaypoints(PathfindingObject previousObject, PathfindingObject nextObject) { return new Vector2[0];; }
// -------------------------------- for pathfinding -------------------------------- public override PathfindingObject[] GetNeighbours() { PathfindingObject[] returnArray = new PathfindingObject[1]; returnArray[0] = roadConnection; return(returnArray); }
static PathfindingObject[] GenerateRoadPath(PathfindingObject endObject, Dictionary<int, PathfindingObject> openList) { int index = 0; PathfindingObject curObject = endObject; bool loopEnabled = true; PathfindingObject[] waypoints = new PathfindingObject[1024]; // add position of first cell, then look if that cell has a fakeParent // if so, increase index and add in next loop to list // otherwise, stop loop while (loopEnabled) { //print ("index = " + index + " and size = " + openList.Count); waypoints[index] = curObject; if (curObject.HasFakeParent()) { curObject = curObject.GetFakeParent(); index++; } else loopEnabled = false; // while loop protection if (index > 999999) { loopEnabled = false; print("while loop crash"); } } // create returnable list with correct size and add end position at start PathfindingObject[] return_waypoints = new PathfindingObject[index + 1]; for (int i = 0; i < return_waypoints.Length; i++) { return_waypoints[i] = waypoints[i]; } // now create new list with all the Vector3 waypoints Vector2[] position_waypoints = new Vector2[return_waypoints.Length * 2]; int vectorIndex = 0; for (index = 0; index < return_waypoints.Length; index++) { Vector2[] temp_waypoints; // if not first or last if (index != 0 && index != (return_waypoints.Length - 1)) temp_waypoints = return_waypoints[index].GetWaypoints(return_waypoints[index - 1], return_waypoints[index + 1]); else { // if first or last index temp_waypoints = new Vector2[1]; temp_waypoints[0] = return_waypoints[index].GetWaypoint(); } // loop list from pathfindingObject and add to list for (int k = 0; k < temp_waypoints.Length; k++) { position_waypoints[vectorIndex] = temp_waypoints[k]; vectorIndex++; } } position_waypoints = Helper.ResizeArray(position_waypoints, vectorIndex); if (debugging) { DrawPath(position_waypoints, 0.2f); } return return_waypoints; }
/* * Test if all the conditions are verified so that passengers and airplanes can be spawned * in the form of a Flight being created */ bool ReadyForFlightCreation(PathfindingObject pathObject, FutureFlight futureFlight) { // test if the parking spot has a road connection if (!futureFlight.parkingSpot.HasRoadConnection()) { return false; } // test if runways are reachable else if (!AreRunwaysReachable(futureFlight.parkingSpot)) { return false; } // test if there are entrances else if (airport.GetAllEntrances().Count < 1) return false; return true; }
// -------------------------------- for pathfinding -------------------------------- public override PathfindingObject[] GetNeighbours() { PathfindingObject[] returnArray = new PathfindingObject[1]; returnArray[0] = roadConnection; return returnArray; }