void Start() { try { config_file = GameObject.FindGameObjectsWithTag("Persistant_Data")[0].GetComponent <persistant_data>().path_to_osm; // read data from menue conn = new SumoTraciConnection(sumo_bin, config_file); //set some options conn.addOption("step-length", "0.1"); //timestep 100 ms conn.addOption("start", ""); conn.runServer(); conn.do_timestep(); carList = new List <Auto>(); linkList = new List <Link>(); ReadLanes(); printLanes(linkList); //for (int i = 0; i < 300; i++) //{ // ReadCars(); //} //printCars(carList); //Debug.Log("Invoke?"); //InvokeRepeating("Readcars", 1, 0.3F); //Debug.Log("Afterinvoke"); } catch (System.Exception) { conn.close(); } }
void Start() { conn = new SumoTraciConnection(sumo_bin, config_file); //set some options conn.addOption("step-length", "0.1"); //timestep 100 ms conn.addOption("start", ""); conn.runServer(); for (int i = 0; i < 10000; i++) { conn.do_timestep(); } conn.do_timestep(); coches = new List <Auto>(); Debug.Log("Sos puto?"); // InvokeRepeating("ReadCoches", 1, 0.3F); Debug.Log("Si, mucho"); }
/* * Initialize * * Pseudo : * * conn = new SumoTraciConnection(sumo_dir,config_file) * conn.runServer() * launchSumoInRemotePort() * tcp_connectToSUMO() * conn.do_timestep() * readLanes() * printLanes() * */ void Initialize() { conn = new SumoTraciConnection(sumo_bin, config_file); //set some options conn.addOption("step-length", "0.3333"); //timestep 33.33ms - 30 frames a second conn.addOption("start", null); conn.runServer(); for (int i = 0; i < 100; i++) { conn.do_timestep(); } lanes = new List <GameObject>(); vehicles = new List <GameObject>(); laneParent = new GameObject(); laneParent.name = "lanesCreatedOnRuntime"; vehicleParent = new GameObject(); vehicleParent.name = "vehiclesCreatedOnRuntime"; vehiclesCreationSuccess = false; }