/* * private static GameObject PlacePoi(float x, float z, float randX, GameObject start, int counter) * { * counter += 1; * Vector3 location = new Vector3(x+Random.Range(0f, 3f), 0, z+Random.Range(-1f, 3f)); * Collider[] hitColliders = Physics.OverlapSphere(location, 2f); * Debug.Log(hitColliders.Length); * //return Instantiate(Resources.Load("prefab/Cube"), location, Quaternion.identity) as GameObject; * if (hitColliders.Length == 0 || counter > 10) * return Instantiate(Resources.Load("prefab/Cube"), location, Quaternion.identity) as GameObject; * else * return PlacePoi(x, z, randX, start, counter); * } */ public void ConnectPOIs(POI start, POI end) { if (start.walkable == true && end.walkable == true) { start.AddConnection(end); end.AddConnection(start); } }