/// <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[] tObjs = GameObject.FindObjectsOfType(typeof(GSDRoadSystem)); if (tObjs != null && tObjs.Length == 0) { CreateRoadSystem(); return; } else { GSDRoadSystem GSDRS = (GSDRoadSystem)tObjs[0]; Selection.activeGameObject = GSDRS.AddRoad(); } }
/// <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; }