/// <summary>
        /// WARNING: Only call this on an empty scene that has some terrains on it. MicroGSD LLC is not responsbile for data loss if this function is called by user.
        /// </summary>
        public static void RoadArchitectUnitTests()
        {
            CleanupTests();

            //Create new road system and turn off updates:
            GameObject tRoadSystemObj = new GameObject("RoadArchitectSystem1");

            RoadSystem = tRoadSystemObj.AddComponent <GSDRoadSystem>();  //Add road system component.
            RoadSystem.opt_bAllowRoadUpdates = false;

            int    numTests      = 5;
            double totalTestTime = 0f;

            for (int i = 1; i <= numTests; i++)
            {
                UnityEngine.Debug.Log("Running test " + i);
                double testTime = RunTest(i);
                totalTestTime += testTime;
                UnityEngine.Debug.Log("Test " + i + " complete.  Test time: " + testTime + "ms");
            }
            UnityEngine.Debug.Log("All tests completed.  Total test time: " + totalTestTime + "ms");

            //Turn updates back on and update road:
            RoadSystem.opt_bAllowRoadUpdates = true;
            RoadSystem.UpdateAllRoads();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Use this to create nodes via coding while in editor mode. Make sure opt_bAllowRoadUpdates is set to false in RS.GSDRS.opt_bAllowRoadUpdates.
        /// </summary>
        /// <param name="RS">The road system to create nodes on.</param>
        /// <param name="NodeLocation">The location of the newly created node.</param>
        /// <returns></returns>
        public static GSDRoad CreateRoad_Programmatically(GSDRoadSystem GSDRS, ref List<Vector3> tLocs) {
            GameObject tRoadObj = GSDRS.AddRoad(false);
            GSDRoad tRoad = tRoadObj.GetComponent<GSDRoad>();

            int hCount = tLocs.Count;
            for (int i = 0; i < hCount; i++) {
                CreateNode_Programmatically(tRoad, tLocs[i]);
            }

            return tRoad;
        }
Ejemplo n.º 3
0
        private static void RoadArchitectUnitTest1()
        {
            //Create node locations:
            List <Vector3> nodeLocations = new List <Vector3>();
            int            MaxCount      = 18;
            float          tMod          = 100f;
            Vector3        xVect         = new Vector3(50f, 40f, 50f);

            for (int i = 0; i < MaxCount; i++)
            {
                //tLocs.Add(xVect + new Vector3(tMod * Mathf.Pow((float)i / ((float)MaxCount * 0.15f), 2f), 1f*((float)i*1.25f), tMod * i));
                nodeLocations.Add(xVect + new Vector3(tMod * Mathf.Pow((float)i / ((float)25 * 0.15f), 2f), 0f, tMod * i));
            }

            //Get road system create road:
            GSDRoadSystem GSDRS = (GSDRoadSystem)GameObject.Find("RoadArchitectSystem1").GetComponent <GSDRoadSystem>();
            GSDRoad       tRoad = GSDRoadAutomation.CreateRoad_Programmatically(GSDRS, ref nodeLocations);

            //Bridge0: (Arch)
            tRoad.GSDSpline.mNodes[4].bIsBridgeStart        = true;
            tRoad.GSDSpline.mNodes[4].bIsBridgeMatched      = true;
            tRoad.GSDSpline.mNodes[7].bIsBridgeEnd          = true;
            tRoad.GSDSpline.mNodes[7].bIsBridgeMatched      = true;
            tRoad.GSDSpline.mNodes[4].BridgeCounterpartNode = tRoad.GSDSpline.mNodes[7];
            tRoad.GSDSpline.mNodes[4].LoadWizardObjectsFromLibrary("Arch12m-2L", true, true);

            //Bridge1: (Federal causeway)
            tRoad.GSDSpline.mNodes[8].bIsBridgeStart        = true;
            tRoad.GSDSpline.mNodes[8].bIsBridgeMatched      = true;
            tRoad.GSDSpline.mNodes[8].BridgeCounterpartNode = tRoad.GSDSpline.mNodes[10];
            tRoad.GSDSpline.mNodes[8].LoadWizardObjectsFromLibrary("Causeway1-2L", true, true);
            tRoad.GSDSpline.mNodes[10].bIsBridgeEnd     = true;
            tRoad.GSDSpline.mNodes[10].bIsBridgeMatched = true;

            //Bridge2: (Steel)
            tRoad.GSDSpline.mNodes[11].bIsBridgeStart        = true;
            tRoad.GSDSpline.mNodes[11].bIsBridgeMatched      = true;
            tRoad.GSDSpline.mNodes[11].BridgeCounterpartNode = tRoad.GSDSpline.mNodes[13];
            tRoad.GSDSpline.mNodes[11].LoadWizardObjectsFromLibrary("Steel-2L", true, true);
            tRoad.GSDSpline.mNodes[13].bIsBridgeEnd     = true;
            tRoad.GSDSpline.mNodes[13].bIsBridgeMatched = true;

            //Bridge3: (Causeway)
            tRoad.GSDSpline.mNodes[14].bIsBridgeStart        = true;
            tRoad.GSDSpline.mNodes[14].bIsBridgeMatched      = true;
            tRoad.GSDSpline.mNodes[16].bIsBridgeEnd          = true;
            tRoad.GSDSpline.mNodes[16].bIsBridgeMatched      = true;
            tRoad.GSDSpline.mNodes[14].BridgeCounterpartNode = tRoad.GSDSpline.mNodes[16];
            tRoad.GSDSpline.mNodes[14].LoadWizardObjectsFromLibrary("Causeway4-2L", true, true);
        }
 public static void AddRoad()
 {
     Object[] tObjs = GameObject.FindObjectsOfType(typeof(GSDRoadSystem));
     if (tObjs != null && tObjs.Length == 0)
     {
         CreateRoadSystem();
         return;
     }
     else
     {
         GSDRoadSystem GSDRS = (GSDRoadSystem)tObjs[0];
         Selection.activeGameObject = GSDRS.AddRoad();
     }
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Use this to create nodes via coding while in editor mode. Make sure opt_bAllowRoadUpdates is set to false in RS.GSDRS.opt_bAllowRoadUpdates.
        /// </summary>
        /// <param name="RS">The road system to create nodes on.</param>
        /// <param name="NodeLocation">The location of the newly created node.</param>
        /// <returns></returns>
        public static GSDRoad CreateRoad_Programmatically(GSDRoadSystem GSDRS, ref List <Vector3> tLocs)
        {
            GameObject tRoadObj = GSDRS.AddRoad(false);
            GSDRoad    tRoad    = tRoadObj.GetComponent <GSDRoad>();

            int hCount = tLocs.Count;

            for (int i = 0; i < hCount; i++)
            {
                CreateNode_Programmatically(tRoad, tLocs[i]);
            }

            return(tRoad);
        }
 public static void AddRoad()
 {
     Object[] allRoadSystemObjects = GameObject.FindObjectsOfType(typeof(GSDRoadSystem));
     if (allRoadSystemObjects != null && allRoadSystemObjects.Length == 0)
     {
         CreateRoadSystem();
         return;
     }
     else
     {
         GSDRoadSystem firstRoadSystem = (GSDRoadSystem)allRoadSystemObjects[0];
         Selection.activeGameObject = firstRoadSystem.AddRoad();
     }
 }
    public static void CreateRoadSystem()
    {
        Object[] tObj = GameObject.FindObjectsOfType(typeof(GSDRoadSystem));
        int      i    = (tObj.Length + 1);

        tObj = null;

        GameObject    tRoadSystemObj = new GameObject("RoadArchitectSystem" + i.ToString());
        GSDRoadSystem tRoadSystem    = tRoadSystemObj.AddComponent <GSDRoadSystem>(); //Add road system component.

        tRoadSystem.AddRoad(true);                                                    //Add road for new road system.

        GameObject IntersectionsMasterObject = new GameObject("Intersections");

        IntersectionsMasterObject.transform.parent = tRoadSystemObj.transform;
    }
    public static void CreateRoadSystem()
    {
        Object[] allRoadSystemObjects = GameObject.FindObjectsOfType(typeof(GSDRoadSystem));
        int      nextCount            = (allRoadSystemObjects.Length + 1);

        allRoadSystemObjects = null;

        GameObject    newRoadSystemObject = new GameObject("RoadArchitectSystem" + nextCount.ToString());
        GSDRoadSystem newRoadSystem       = newRoadSystemObject.AddComponent <GSDRoadSystem>();

        newRoadSystem.AddRoad(true);//Add road for new road system.

        GameObject masterIntersectionsObject = new GameObject("Intersections");

        masterIntersectionsObject.transform.parent = newRoadSystemObject.transform;
    }
Ejemplo n.º 9
0
    public RACityGen()
    {
        Debug.Log("RACityGen Constructor called");
        if (GameObject.Find("RoadArchitectSystem"))
        {
            tRoadSystemObj = GameObject.Find("RoadArchitectSystem");
        }
        else
        {
            tRoadSystemObj = new GameObject("RoadArchitectSystem");
        }

        roadSystem = tRoadSystemObj.AddComponent <GSDRoadSystem>();
        roadSystem.opt_bAllowRoadUpdates = false;
        roadSystem.opt_bMultithreading   = true; // This is key for runtime generation
        createdRoads = new List <GSDRoad>();
    }
Ejemplo n.º 10
0
        /// <summary>
        /// WARNING: Only call this on an empty scene that has some terrains on it. MicroGSD LLC is not responsbile for data loss if this function is called by user.
        /// </summary>
        public static void RoadArchitectUnitTests()
        {
            //Get the existing road system, if it exists:
            GameObject GSDRS = (GameObject)GameObject.Find("RoadArchitectSystem1");

            //Destroy the terrain histories:
            if (GSDRS != null)
            {
                Object[] tRoads = GSDRS.GetComponents <GSDRoad>();
                foreach (GSDRoad xRoad in tRoads)
                {
                    GSD.Roads.GSDTerraforming.TerrainsReset(xRoad);
                }
                Object.DestroyImmediate(GSDRS);
            }

            //Reset all terrains to 0,0
            Object[] zTerrains = Object.FindObjectsOfType <Terrain>();
            foreach (Terrain xTerrain in zTerrains)
            {
                xTerrain.terrainData.SetHeights(0, 0, new float[513, 513]);
            }

            //Create new road system and turn off updates:
            GameObject    tRoadSystemObj = new GameObject("RoadArchitectSystem1");
            GSDRoadSystem roadSystem     = tRoadSystemObj.AddComponent <GSDRoadSystem>(); //Add road system component.

            roadSystem.opt_bAllowRoadUpdates = false;

            //Perform unit tests:
            RoadArchitectUnitTest1();   //Bridges
            RoadArchitectUnitTest2();   //2L intersections
            RoadArchitectUnitTest3();   //4L intersections
            RoadArchitectUnitTest4();   //Large suspension bridge
            RoadArchitectUnitTest5();   //Long road:

            //Turn updates back on and update road:
            roadSystem.opt_bAllowRoadUpdates = true;
            roadSystem.UpdateAllRoads();
        }
Ejemplo n.º 11
0
	public void UpdateRoad(RoadUpdateTypeEnum tUpdateType = RoadUpdateTypeEnum.Full){
        if (!GSDRS.opt_bAllowRoadUpdates) {
            GSDSpline.Setup();
            Editor_bIsConstructing = false;
            return;
        }

		if(Editor_bIsConstructing){
			return;	
		}

		SetupUniqueIdentifier();
		if(bProfiling){ Profiler.BeginSample("UpdateRoadPrelim"); }
		opt_RoadDefinition = Mathf.Clamp(opt_RoadDefinition,1f,50f);
		opt_LaneWidth = Mathf.Clamp(opt_LaneWidth,0.2f,500f);
		EditorConstructionStartTime = Time.realtimeSinceStartup;
		EditorTitleString = "Updating " + transform.name + "...";
		System.GC.Collect();
		
		if(opt_SaveTerrainHistoryOnDisk){
			ConstructRoad_LoadTerrainHistory();
		}
		
		CheckMats();

		EditorUtility.ClearProgressBar();
		
		bProfiling = true;
		if(GSDRS.opt_bMultithreading){ bProfiling = false; }
		
        //Set all terrains to height 0:
        GSD.Roads.GSDTerraforming.CheckAllTerrainsHeight0();

		EditorProgress = 20;
		bEditorProgressBar = true;
		if(Editor_bIsConstructing){
			if(TerrainCalcsJob != null){ TerrainCalcsJob.Abort(); TerrainCalcsJob = null; }
			if(RoadCalcsJob1 != null){ RoadCalcsJob1.Abort(); RoadCalcsJob1 = null; }
			if(RoadCalcsJob2 != null){ RoadCalcsJob2.Abort(); RoadCalcsJob2 = null; }
			Editor_bIsConstructing = false;
		}  
	
//		if(Application.isPlaying || !Application.isEditor){ return; }
//		if(Application.isEditor && UnityEditor.EditorApplication.isPlaying){ return; }
//		if(Application.isEditor && UnityEditor.EditorApplication.isPlayingOrWillChangePlaymode){ return; }

		//In here for intersection patching purposes:
		int mCount = GSDSpline.GetNodeCount();
		GSDSplineN tNode = null;
		GSDSplineN tNode1 = null;
		GSDSplineN tNode2 = null;
		if(GSDSpline.CheckInvalidNodeCount()){
			GSDSpline.Setup();	
			mCount = GSDSpline.GetNodeCount();
		}
		if(mCount > 1){
			for(int i=0;i<mCount;i++){
//				try{
					tNode = GSDSpline.mNodes[i];
//				}catch{
//					Editor_bIsConstructing = false;
//					EditorUpdateMe = true;
//					return;	
//				}
				
				//If node is intersection with an invalid GSDRI, mark it at non-intersection. Just-in-case.
				if(tNode.bIsIntersection && tNode.GSDRI == null){
					tNode.bIsIntersection = false;
					tNode.id_intersection_othernode = -1;
					tNode.Intersection_OtherNode = null;
				}
				//If node is intersection, re-setup:
				if(tNode.bIsIntersection && tNode.GSDRI != null){
					tNode1 = tNode.GSDRI.Node1;
					tNode2 = tNode.GSDRI.Node2;
					tNode.GSDRI.Setup(tNode1,tNode2);
					tNode.GSDRI.DeleteRelevantChildren(tNode, tNode.GSDSpline.tRoad.transform.name);
					//If primary node on intersection, do more re-setup:
					if(tNode.GSDRI.Node1 == tNode){
						tNode.GSDRI.Lanes = opt_Lanes;
						tNode.GSDRI.name = tNode.GSDRI.transform.name;
					}
					//Setup construction objects:
					tNode.GSDRI.Node1.iConstruction = new GSD.Roads.GSDIntersections.iConstructionMaker();
					tNode.GSDRI.Node2.iConstruction = new GSD.Roads.GSDIntersections.iConstructionMaker();
				}

				//Store materials and physical materials for road and or shoulder cuts on each node, if necessary:
				tNode.StoreCuts();
			}
		}
		name = transform.name;
		

		
		GSDSpline.RoadWidth = RoadWidth();
//		if(bProfiling){ Profiler.BeginSample("SplineSetup"); }
		GSDSpline.Setup();
//		if(bProfiling){ Profiler.EndSample(); }
		mCount = GSDSpline.GetNodeCount();

		if(GSDSpline == null || GSDSpline.mNodes == null){
			MostRecentNodeCount = 0;
		}else{
			MostRecentNodeCount = GSDSpline.GetNodeCount();	
		}
		
		if(opt_UseDefaultMaterials){
			SetDefaultMats();	
		}
		
		if(opt_UseDefaultMaterials){
			if(DetectInvalidDefaultMatsForUndo()){
				SetAllCutsToCurrentMaterials();	
			}
		}
		
		//Hiding in hierarchy:
		for(int i=0;i<mCount;i++){
			tNode = GSDSpline.mNodes[i];
			if(tNode != null){
				if(tNode.bIsIntersection || tNode.bSpecialEndNode){
					tNode.ToggleHideFlags(true);
				}else{
					tNode.ToggleHideFlags(false);
				}
			}
		}
		
		int cCount = transform.childCount;
		GameObject tMainMeshes = null;
		List<GameObject> tObjs = new List<GameObject>();
		for(int i=0;i<cCount;i++){
			if(transform.GetChild(i).transform.name.ToLower().Contains("mainmeshes")){
				tMainMeshes = transform.GetChild(i).transform.gameObject;
				tObjs.Add(tMainMeshes);
			}
		}
		for(int i=(tObjs.Count-1);i>=0;i--){
			tMainMeshes = tObjs[i];
			Object.DestroyImmediate(tMainMeshes);
		}
		
		if(mCount < 2){
			//Delete old objs and return:
			if(MainMeshes != null){ Object.DestroyImmediate(MainMeshes); }
			if(MeshRoad != null){ Object.DestroyImmediate(MeshRoad); }
			if(MeshShoR != null){ Object.DestroyImmediate(MeshShoR); }
			if(MeshShoL != null){ Object.DestroyImmediate(MeshShoL); }
			if(MeshiLanes != null){ Object.DestroyImmediate(MeshiLanes); }
			if(MeshiLanes0 != null){ Object.DestroyImmediate(MeshiLanes0); }
			if(MeshiLanes1 != null){ Object.DestroyImmediate(MeshiLanes1); }
			if(MeshiLanes2 != null){ Object.DestroyImmediate(MeshiLanes2); }
			if(MeshiLanes3 != null){ Object.DestroyImmediate(MeshiLanes3); }
			if(MeshiMainPlates != null){ Object.DestroyImmediate(MeshiMainPlates); }
			if(MeshiMarkerPlates != null){ Object.DestroyImmediate(MeshiMarkerPlates); }
			if(bProfiling){ Profiler.EndSample(); }
			return;
		}
		
		GSDSpline.HeightHistory = new List<KeyValuePair<float, float>>();
		if(GSDRS == null){ GSDRS = transform.parent.GetComponent<GSDRoadSystem>(); } //Compatibility update.
		
		if(GSDRS.opt_bMultithreading){
			Editor_bIsConstructing = true;
		}else{
			Editor_bIsConstructing = false;
		}
		Editor_bConstructionID = 0;
		
		
		
		//Check if road takes place on only 1 terrain:
		Terrain tTerrain = GSD.Roads.GSDRoadUtil.GetTerrain(GSDSpline.mNodes[0].pos);
		bool bSameTerrain = true;
		for(int i=1;i<mCount;i++){
			if(tTerrain != GSD.Roads.GSDRoadUtil.GetTerrain(GSDSpline.mNodes[0].pos)){
				bSameTerrain = false;
				break;
			}
		}

		RCS = new RoadConstructorBufferMaker(this, tUpdateType);

		if(bSameTerrain){
			RCS.tTerrain = tTerrain;	
		}else{
			RCS.tTerrain = null;
		}
		tTerrain = null;
		
		if(bProfiling){ Profiler.EndSample(); }
		
		if(GSDRS.opt_bMultithreading){
			if(RCS.bTerrainOn || TerrainHistory == null){
				GSDTerraforming.ProcessRoad_Terrain_Hook1(GSDSpline,this);
			}else{
				ConstructRoad2();
			}
		}else{
			UpdateRoad_NoMultiThreading();
		}
	}
Ejemplo n.º 12
0
    static void CreateRoadNetwork(GSDRoadSystem roadSystem, string netPath, int roadNum)
    {
        for (int i = 1; i <= roadNum; i++)
        {
            string fileName = netPath + "/Road" + i.ToString();

            StreamReader reader = new StreamReader(fileName);
            string       line   = reader.ReadLine();

            List <Vector3> nodePos = new List <Vector3>();
            while (line != null)
            {
                string[] words = line.Split(',');
                nodePos.Add(new Vector3(float.Parse(words[0]), float.Parse(words[1]), float.Parse(words[2])));
                line = reader.ReadLine();
            }
            reader.Close();

            GSDRoad tmpRoad = null;
            tmpRoad = GSDRoadAutomation.CreateRoad_Programmatically(roadSystem, ref nodePos);

            // TODO: the generation of intersection doesn't work very well at this point
            // Weizi: seems like an intersection will only get created when two nodes are within 3.3 distance
            //GSDRoadAutomation.CreateIntersections_ProgrammaticallyForRoad(tmpRoad, GSDRoadIntersection.iStopTypeEnum.TrafficLight1, GSDRoadIntersection.RoadTypeEnum.NoTurnLane); // GSDRoadIntersection.iStopTypeEnum.TrafficLight2 doesn't work
        }


        ///////////////////////////
        // Debug file reading
        ///////////////////////////

        /*int hCount = nodePos.Count;
         * Debug.Log(hCount.ToString());
         * for (int i = 0; i < hCount; i++)
         * {
         *  string ot = nodePos[i].x.ToString() + " " + nodePos[i].y.ToString() + " " + nodePos[i].z.ToString() + "\n";
         *  Debug.Log(ot);
         * }*/


        ///////////////////////////
        // Test road and intersection creation by manually specifying some road nodes
        ///////////////////////////

        /*float StartLocX = 800f;
         * float StartLocZ = 200f;
         * float GapZ = 200f;
         * float tHeight = 0.03f;
         * GSDRoad bRoad = null;
         *
         *
         * // Create roads
         * List<Vector3> nodePos = new List<Vector3>();
         * for (int i = 0; i < 5; i++)
         * {
         *  nodePos.Add(new Vector3(StartLocX + (i * 200f), tHeight, 600f));
         * }
         * bRoad = GSDRoadAutomation.CreateRoad_Programmatically(roadSystem, ref nodePos);
         *
         * nodePos.Clear();
         * for (int i = 0; i < 5; i++)
         * {
         *  nodePos.Add(new Vector3(StartLocX, tHeight, StartLocZ + (i * GapZ) + 3.3f));
         * }
         * bRoad = GSDRoadAutomation.CreateRoad_Programmatically(roadSystem, ref nodePos);
         *
         * // Create intersections (TrafficLight2 doesn't work)
         * // Weizi: seems like an intersection will only get created when two nodes are within 3.3 distance
         * GSDRoadAutomation.CreateIntersections_ProgrammaticallyForRoad(bRoad, GSDRoadIntersection.iStopTypeEnum.TrafficLight1, GSDRoadIntersection.RoadTypeEnum.NoTurnLane);*/
    }
Ejemplo n.º 13
0
    static void Create()
    {
        //****************************************************************
        // variables
        string netPath           = "C:/DeepDrive/data/road_networks/halfCircle/";
        int    roadNum           = 1;
        bool   createNetworkFlag = true;
        //int roadNum = Directory.GetFiles(netPath).Length - 1;
        //****************************************************************


        // Create a terrain that is big enough to hold the road network
        // (requires "RoadBounds" in the above folder)
        StreamReader reader = new StreamReader(netPath + "RoadBounds");
        string       line   = reader.ReadLine();

        string[] words = line.Split(',');
        Debug.Log("Terrain bounds: minx=" + words[0] + ", maxx=" + words[1] + ", minz=" + words[2] + ", maxz=" + words[3]);
        float  minx       = float.Parse(words[0]);
        float  maxx       = float.Parse(words[1]);
        float  minz       = float.Parse(words[2]);
        float  maxz       = float.Parse(words[3]);
        double transx     = minx * 1.5;
        double transz     = minz * 1.5;
        float  ctrz       = (minz + maxz) / 2;
        double twidth     = (maxx - minx) * 1.5; // make the terrain 1.5x bigger
        double tlength    = (maxz - minz) * 1.5;
        int    twidthInt  = (int)twidth;
        int    tlengthInt = (int)tlength;

        CreateTerrain(twidthInt, tlengthInt, transx, transz);
        reader.Close();


        // Create a road network
        if (createNetworkFlag)
        {
            string roadSysStr = "RoadArchitectSystem1";

            // Get the existing road system (if it exists) and destory its consisting roads
            GameObject exRoadSystemObj = (GameObject)GameObject.Find(roadSysStr);
            if (exRoadSystemObj != null)
            {
                Object[] tRoads = exRoadSystemObj.GetComponents <GSDRoad>();
                foreach (GSDRoad xRoad in tRoads)
                {
                    GSD.Roads.GSDTerraforming.TerrainsReset(xRoad);
                }
                Object.DestroyImmediate(exRoadSystemObj);
            }

            // Create a new road system and turn off its updates (only generating the nodes but not the mesh)
            GameObject    roadSystemObj = new GameObject(roadSysStr);
            GSDRoadSystem roadSystem    = roadSystemObj.AddComponent <GSDRoadSystem>(); //Add road system component.
            roadSystem.opt_bAllowRoadUpdates = false;                                   // this has to be set to false in order for following functions to operate

            // Create a road network
            CreateRoadNetwork(roadSystem, netPath, roadNum);

            // Turn updates back on and update the roads (create meshes for connecting the road nodes)
            roadSystem.opt_bAllowRoadUpdates = true;
            roadSystem.UpdateAllRoads();
        }
    }