if (Vector3.Distance(targetNode.transform.position, endPos) < parentToPointTraceDistance) {
print("We've found our goal");
closedList[closedListIndexPos].node = targetNode;
for (j = 0; j < closedList.length; j++) {
if (closedList[j].node != null) {
closedListNodeLength = j;
}
}
DestroyOpenListNodes();
pathDoneIndex = closedListIndexPos;
pathFound = ***e;
return;
}
if ((index % 2) == 0)
moveCost = 10;
else
moveCost = 14;
print(jsOpenList.length);
jsOpenList.Add(new nodeData());
print(jsOpenList.length);
if (!Physics.Linecast(Vector3(closedList[closedListIndexPos].node.transform.position.x,0.1,closedList[closedListIndexPos].node.transform.position.z),endPos)) {
if (closedListIndexPos > 0) { // this just means we have added the first round of position to the open list
if ((Mathf.RoundToInt(endPos.x) != Mathf.RoundToInt(closedList[closedListIndexPos-1].node.transform.position.x))
|| (Mathf.RoundToInt(endPos.z) != Mathf.RoundToInt(closedList[closedListIndexPos-1].node.transform.position.z))) { // if our x or y is not our previous closed list node
print("We are not on the closed list");
var tempIndex : int = 0;
//print(jsOpenList.length);
for (i = 0; i < jsOpenList.length; i++) { // now we have to search our total open list
else {// if a searched position is on the open list
if (jsOpenList[tempIndex].gCost < (moveCost + closedList[closedListIndexPos].gCost)) { // see if the move cost is better than what it takes to move from our last closed list pos
//print("It is better to go to jsOpenList[tempIndex] than it is to go to closedList[closedListIndexPos]");