public override int Traverse() { if (useIDInput) { if (useIDInput && IDInput == null) { IDInput = inputKnobs[1]; } if (IDInput.connected()) { entityID = (IDInput.connections[0].body as SpawnEntityNode).entityID; } else { Debug.LogWarning("Name Input not connected!"); } } Debug.Log("Entity ID: " + entityID); Debug.Log("Target ID: " + targetEntityID); if (!(target && entity)) // room for improvement but probably unecessary { for (int i = 0; i < AIData.entities.Count; i++) { if (AIData.entities[i] is AirCraft airCraft) { if (AIData.entities[i].ID == entityID) { entity = airCraft; } if (AIData.entities[i].ID == targetEntityID) { target = AIData.entities[i]; } } } } if (!useNumericalAngle) { if (!(target && entity)) { Debug.LogWarning($"Could not find target/entity! {target} {entity}"); return(0); } Vector2 targetVector = target.transform.position - entity.transform.position; //calculate difference of angles and compare them to find the correct turning direction if (!(entity is PlayerCore)) { if (!asynchronous) { entity.GetAI().RotateTo(targetVector, continueTraversing); } else { entity.GetAI().RotateTo(targetVector); } } else { entity.StartCoroutine(rotatePlayer(targetVector)); } } else { entity.transform.rotation = Quaternion.Euler(new Vector3(0, 0, float.Parse(angle))); return(0); } return(asynchronous ? 0 : -1); }