//AI-Methods //Sent by MoveCar public IEnumerator GetDataFromServerRequest() { Debug.Log("GetDataFromServerRequestMethod called!!!"); //If AI is controlling, then we want it to send wall input data //&& !CarControll.isFinished while (CarControll.isControlledByAI) { yield return(new WaitForSeconds(dataDelay)); //Debug.Log("Sending distance from wall"); string url = "http://localhost:80/getDrivingData"; //First send distance from wall data Dictionary <string, string> postHeaders = new Dictionary <string, string>(); postHeaders.Add("Content-Type", "application/json"); byte[] bytes = Encoding.UTF8.GetBytes(sensorData.GetDistanceToObject()); WWW www = new WWW(url, bytes, postHeaders); //Receive data StartCoroutine(WaitForRequest(www)); } }