private GameObject GetSection(RoadType type) { if (type == RoadType.Start) return GetRandomSection(StartRoads); if (type == RoadType.Normal) return GetRandomSection(NormalRoads); if (type == RoadType.Exotic) return GetRandomSection(ExoticRoads); return null; }
/// <summary> /// De hoofdfunctie van de pathfinding. /// </summary> /// <param name="a">Start positie als AstarObject</param> /// <param name="b">Eind positie als AstarObject</param> /// <param name="T"> Het type weg waarin hij moet zoeken</param> /// <returns></returns> List<Point> FindRoadPath(Road a, Road b, RoadType T) { AstarObject[,] Set = new AstarObject[14, 9]; for (int x = 0; x < 14; x++) { for (int y = 0; y < 9; y++) { Set[x, y] = new AstarObject(x, y, this); } } Heap<AstarObject> OpenSet = new Heap<AstarObject>(14 * 9); HashSet<AstarObject> ClosedSet = new HashSet<AstarObject>(); AstarObject Start = Set[a.X, a.Y]; AstarObject End = Set[b.X, b.Y]; OpenSet.Add(Start); while (OpenSet.Count > 0) { AstarObject CurrentLocation = OpenSet.RemoveFirst(); ClosedSet.Add(CurrentLocation); if (CurrentLocation == End) { return RetracePath(Start, End); //Retracepath and stuff. } List<AstarObject> Neighbours = GetNeighbours(CurrentLocation, ref Set, NeighbourhoodType.Neumann, MapsizeXR, MapsizeYR); foreach (AstarObject neighbour in Neighbours) { if (neighbour.RType != T || ClosedSet.Contains(neighbour)) { continue; } int newMovementCostToNeighbour = CurrentLocation.gCost + GetDistance(CurrentLocation, neighbour); if (newMovementCostToNeighbour < neighbour.gCost || !OpenSet.Contains(neighbour)) { neighbour.gCost = newMovementCostToNeighbour; neighbour.hCost = GetDistance(neighbour, End); neighbour.parent = CurrentLocation; if (!OpenSet.Contains(neighbour)) { OpenSet.Add(neighbour); } else { OpenSet.UpdateItem(neighbour); } } } } return new List<Point>(); }
public Road(Node from, Node to, RoadType type, Partitions partition) { From = from; To = to; Type = type; Partition = partition; Vehicles = new List<Vehicle>(); }
public Road(IEnumerable <Point> positions) { roadType = RoadType.Unpaved; Segments = positions .OrderBy(p => p.X) .ThenBy(p => p.Y) .Select(p => new RoadSegment(p)) .ToList(); }
public static RoadType nextRoad() { int count = Enum.GetNames(typeof(RoadType)).Length; RoadType type = (RoadType)cur; cur += 1; cur %= count; return(type); }
public void PopulateAutoTest(string distancesString, string loadsString, string fullDamage, AutoType autoType, RoadType roadType, bool isFederal, bool isKlimat, float inaccuracyScales, float inaccuracyRoulette) { Settings.Default.Klimat_usloviya = isKlimat; Settings.Default.YearIndex = 1.9749f; Settings.Default.DopustimiyProcentAxis = 5; Settings.Default.DopustimiyProcentAxis = 5; var auto = new Auto { InaccuracyRoulette = inaccuracyRoulette, AutoType = autoType, Road = { RoadType = roadType, Distance = 100, IsFederalRoad = isFederal, IsSoftClothes = false }, Scales = { Inaccuracy = inaccuracyScales } }; string[] distances = distancesString.Split(' '); string[] loads = loadsString.Split(' '); for (int i = 0; i < loads.Length; i++) { var state = AxisType.Single; float distance = i < distances.Length ? float.Parse(distances[i]) : 0; float weightValue = float.Parse(string.Concat(loads[i].Where(c => !char.IsLetter(c)))); if (loads[i].Contains("D")) { state = AxisType.Double; } if (loads[i].Contains("P")) { state = state == AxisType.Double ? AxisType.DoubleAndPnevmo : AxisType.SingleAndPnevmo; } auto.AddNewAxis(state, distance, weightValue); } Calculator.Populate(auto); float damage = float.Parse(fullDamage); Assert.AreEqual(Math.Round(auto.FullAutoDamage), Math.Round(damage), $"Масса:{Environment.NewLine}{auto.FullWeightData}{Environment.NewLine}" + $"Нагрузки:{Environment.NewLine}{string.Join(Environment.NewLine, auto.AxisList.Select(a => a.ToString()))}"); }
private float CreateRoadTile(Vector3 pos, RoadType type) { var go = GetSection(type); var road = (GameObject)Instantiate(go); road.transform.position = pos; road.transform.parent = transform; road.name = "#"+(roadID++)+" road ("+go.name+")"; _roadList.AddLast(road); return road.GetComponent<BoxCollider>().bounds.size.z; }
public void SetTypeAndDirection(RoadType type, RoadDirection direction, bool link_wps = true) { SetType(type); SetDirection(direction); if (link_wps) { LinkWayPoints(); } }
public void Initialize(string id, Tile tile, List <Vector3> verts, string halfWidth) { Id = id; _tile = tile; Type = halfWidth.ToRoadType(); _verts = verts; lineMaterial = Resources.Load("DefaultLine3D") as Material; Draw(_verts); }
private void InitRoadTypesProperty() { _roadTypesControl = new GenericTableRowControl <RoadType>() { TitleValue = "Используемые типы дорог", TitleToolTip = "Представляет собой набор допустимых типов маршрутов в сети, используется при добавлении или обновлении маршрута", OnAdd = alreadyUsedRoadTypes => { var addDialog = new AddStringDialog() { Title = "Новый тип дороги", IsViable = newRoadTypeName => { if (newRoadTypeName.Trim() == "") { ComponentUtils.ShowMessage("Введите не пустое название", MessageBoxImage.Error); return(false); } if (alreadyUsedRoadTypes.Contains(new RoadType() { Name = newRoadTypeName.Trim() })) { ComponentUtils.ShowMessage("Тип дороги с таким названием уже существует", MessageBoxImage.Error); return(false); } return(true); }, RowControl = { TitleValue = "Введите название", Value = "" } }; if (addDialog.ShowDialog() != true) { return(null); } var created = new RoadType() { Name = addDialog.RowControl.Value }; return(new List <RoadType>() { created }); }, Value = _roadTypes.Values }; _roadTypesControl.AddColumns(RoadType.PropertyMatcher()); PropertiesPanel.Children.Add(_roadTypesControl.GetUiElement); }
public RoadType SetUpRoadType(RoadTypeSetUp model) { if (roadType.Equals(RoadType.Paved)) { return(roadType); } double prob = 0; var distanceToCenter = model.SettlementCenter.DistanceTo(this.Center); if (distanceToCenter < model.AvgDistanceToSettlementCenter) { prob += 0.15; } if (distanceToCenter < 0.5 * model.AvgDistanceToSettlementCenter) { prob += 0.15; } if (distanceToCenter > 1.5 * model.AvgDistanceToSettlementCenter) { prob -= 0.15; } else if (this.Length > 0.5 * MaxRoadLength) { prob += 0.05; } foreach (var building in this.Buildings) { if (building is Residence) { prob += 0.01; } else { prob += 0.05; } } switch (model.Epoch) { case Epoch.Second: prob += 0.1; break; case Epoch.Third: prob += 0.2; break; } prob = prob < 0 ? 0.01 : prob; roadType = RandomProvider.NextDouble() > prob ? RoadType.Unpaved : RoadType.Paved; return(roadType); }
public bool isActive; //Gets passed to false when hit //Contructor public Roads(bool act) { type = RoadType.m_null; direction = RoadDirection.m_null; rotation = Quaternion.Euler(0, 0, 0); pos = new Vector2(0, 0); m_GameObjectPrefabType = null; m_GameObjectInstance = null; m_renderer = null; isActive = act; }
public RoadCollection(RoadComponent currentRoad) { collection = new Dictionary <RoadType, RoadComponent>(); placedRoadsByOrder = new List <RoadType>(); RoadType type = currentRoad.GetRoadType(); Add(currentRoad); SetCurrent(type); Place(type); }
public void Add(RoadComponent road) { RoadType type = road.GetRoadType(); if (collection.ContainsKey(type)) { Debug.LogError("RoadCollection:Add: road of this type existed"); return; } collection.Add(type, road); }
public Tile(int z, int x, TileMap _tileMap, TileType _tileType = TileType.GROUND, RoadType _roadType = RoadType.None) { this.row = z; this.col = x; neighbours = new List <Index>(); _8_Neighbours = new List <Index>(); _index = new Index(z, x); tileType = _tileType; tileMap = _tileMap; roadType = _roadType; }
public void Place(RoadType type) { if (collection.ContainsKey(type)) { placedRoadsByOrder.Add(type); } else { Debug.LogError("RoadCollection:Place: collection does not have this type"); } }
private float CreateRoadTile(Vector3 pos, RoadType type) { var go = GetSection(type); var road = (GameObject)Instantiate(go); road.transform.position = pos; road.transform.parent = transform; road.name = "#" + (roadID++) + " road (" + go.name + ")"; _roadList.AddLast(road); return(road.GetComponent <BoxCollider>().bounds.size.z); }
public RoadComponent GetRoadByIndex(int index) { int count = placedRoadsByOrder.Count; if (count > index) { RoadType type = placedRoadsByOrder[index]; return(collection[type]); } return(null); }
public RoadComponent GetLastRoadComponent() { int count = placedRoadsByOrder.Count; if (count > 0) { RoadType type = placedRoadsByOrder[count - 1]; return(collection[type]); } return(null); }
protected override void Tick() { if (Keyboard.current[Key.Digit1].wasPressedThisFrame) { _roadType = RoadType.Traffic; } else if (Keyboard.current[Key.Digit2].wasPressedThisFrame) { _roadType = RoadType.Crawler; } }
public void SetRoadType(RoadType value) { for (int i = 0; i < roadTypes.Length; i++) { roadTypes[i].SetActive(i == (int)value); } buildings.transform.rotation = Quaternion.Euler(0, sidedness[(int)value], 0); roadType = value; }
/// <summary> /// Sets up environment based on given type, modifying /// the config, appending the new setup to the config string /// </summary> /// <param name="type"></param> /// <param name="config"></param> public string Setup(RoadType type) { string _config = ""; string typeName = type.ToString(); _config += SetupFolliage(typeName); _config += SetupHouses(typeName); _config += SetupPavilion(typeName); return(_config); }
private void SetCurrent(RoadType type) { if (collection.ContainsKey(type)) { currentRoad = type; } else { Debug.LogError("RoadCollection:SetCurrent: collection does not have this type"); } }
public static bool TryGetClosestVehicleNode(Vector3 pos, RoadType type, out Vector3 node) { var ret = new NativeVector3(); try { unsafe { return(Call <bool>(GET_CLOSEST_VEHICLE_NODE, pos, new IntPtr(&ret), type, 3.0f, 0)); } } finally { node = ret; } }
public ICharacterBuilder(Transform startParent, ICharacter character, System.Type t, Vector3 spawnPosition, RoadType roadType, CampType campType, Transform[] towes) { mCharacter = character; mT = t; mSpawnPosition = spawnPosition; mCampType = campType; mRoadType = roadType; mTowers = towes; mPrefabName = character.prefabName; mStartParent = startParent; }
/** * Get the present road bits for a specific road type. * @param t The tile to query. * @param rt Road type. * @pre IsNormalRoad(t) * @return The present road bits for the road type. */ public static RoadBits GetRoadBits(this TileIndex t, RoadType rt) { Debug.Assert(IsNormalRoad(t)); switch (rt) { default: throw new NotReachedException(); case RoadType.ROADTYPE_ROAD: return((RoadBits)BitMath.GB(Map._m[t].m5, 0, 4)); case RoadType.ROADTYPE_TRAM: return((RoadBits)BitMath.GB(Map._m[t].m3, 0, 4)); } }
public Way(string name, Node[] nodes, int?lanes, RoadType roadType, Sidewalk sidewalk, int?layer, CrossingType crossing, Surface surface, bool oneWay) { Name = name; Nodes = nodes; Lanes = lanes; RoadType = roadType; Sidewalk = sidewalk; OneWay = oneWay; Layer = layer; Crossing = crossing; Surface = surface; }
public DataTable GetImages(int ID, RoadType type) { if (ID == 0) { return(new DataTable()); } string sql1 = ""; string sql2 = ""; string sql = ""; switch (type) { case RoadType.Section: sql1 = string.Format("SELECT RECORD_ID, PHOTO_NAME, DETAILS FROM PHOTOS where SECTION_ID={0} ", ID); sql2 = string.Format("select d.DIST_ID as RECORD_ID, d.DISTRESS_IMAGE as PHOTO_NAME, dc.DISTRESS_AR_TYPE as DETAILS from DISTRESS d, distress_code dc where d.dist_code=dc.dist_code and SECTION_ID={0} and DISTRESS_IMAGE is not null ", ID); break; case RoadType.Intersect: sql1 = string.Format("SELECT RECORD_ID, PHOTO_NAME, DETAILS FROM PHOTOS where INTER_ID={0} ", ID); sql2 = string.Format("select d.DIST_ID as RECORD_ID, d.DISTRESS_IMAGE as PHOTO_NAME, dc.DISTRESS_AR_TYPE as DETAILS from DISTRESS d, distress_code dc where d.dist_code=dc.dist_code and INTERSECTION_ID={0} and DISTRESS_IMAGE is not null ", ID); break; case RoadType.RegionSecondarySt: sql1 = string.Format("SELECT RECORD_ID, PHOTO_NAME, DETAILS FROM PHOTOS where STREET_ID in (select STREET_ID from STREETS where REGION_ID={0}) ", ID); sql2 = string.Format("select d.DIST_ID as RECORD_ID, d.DISTRESS_IMAGE as PHOTO_NAME, dc.DISTRESS_AR_TYPE as DETAILS from DISTRESS d, distress_code dc where d.dist_code=dc.dist_code and REGION_ID={0} and DISTRESS_IMAGE is not null ", ID); //sql1 = string.Format("SELECT RECORD_ID, PHOTO_NAME, DETAILS FROM PHOTOS where SECOND_ID in (select SECOND_ID from SECONDARY_STREETS where REGION_ID={0}) ", ID); //sql2 = string.Format("select d.DIST_ID as RECORD_ID, d.DISTRESS_IMAGE as PHOTO_NAME, dc.DISTRESS_AR_TYPE as DETAILS from DISTRESS d, distress_code dc where d.dist_code=dc.dist_code and REGION_ID={0} and DISTRESS_IMAGE is not null ", ID); break; case RoadType.MainStreet: sql1 = string.Format("SELECT RECORD_ID, PHOTO_NAME, DETAILS FROM PHOTOS where SECTION_ID in (select section_id from sections where STREET_ID={0}) or INTER_ID in (select INTERSECTION_ID from INTERSECTIONS where STREET_ID={0}) ", ID); // MAIN_STREET_ID sql2 = string.Format("select d.DIST_ID as RECORD_ID, d.DISTRESS_IMAGE as PHOTO_NAME, dc.DISTRESS_AR_TYPE as DETAILS from DISTRESS d, distress_code dc " + " where d.dist_code=dc.dist_code and (SECTION_NO in (select section_no from sections where STREET_ID={0}) " + " or INTER_NO in (select inter_no from INTERSECTIONS where STREET_ID={0})) and DISTRESS_IMAGE is not null ", ID); // MAIN_STREET_ID break; default: break; } if (!string.IsNullOrEmpty(sql1) && !string.IsNullOrEmpty(sql2)) { sql = string.Format("{0} union {1} ", sql1, sql2); return(db.ExecuteQuery(sql)); } else { return(new DataTable()); } }
public void Next() { placedRoadsByOrder.RemoveAt(0); if (placedRoadsByOrder.Count > 0) { currentRoad = placedRoadsByOrder[0]; } else { Debug.LogError("RoadCollection:Next: no next road component"); } }
private Vector3 GetNewRoadItemPosition(RoadType type, bool isFirstEnter) { Vector3 position = _lastRoadItem.transform.position; if (isFirstEnter) { if ((type == RoadType.UpToRight) && (_lastRoadItem.Type == RoadType.DownToLeft)) { position = _lastRoadItem.transform.position + new Vector3( 0f, -RoadSpaceParam, 0f); } else if ((type == RoadType.RightToDown) && (_lastRoadItem.Type == RoadType.LeftToUp)) { position = _lastRoadItem.transform.position + new Vector3( -RoadSpaceParam, 0f, 0f); } else if ((type == RoadType.DownToLeft) && (_lastRoadItem.Type == RoadType.UpToRight)) { position = _lastRoadItem.transform.position + new Vector3( 0f, RoadSpaceParam, 0f); } else if ((type == RoadType.LeftToUp) && (_lastRoadItem.Type == RoadType.RightToDown)) { position = _lastRoadItem.transform.position + new Vector3( RoadSpaceParam, 0f, 0f); } } else { if ((type == RoadType.UpToRight) && (_lastRoadItem.Type == RoadType.DownToLeft)) { position = _lastRoadItem.transform.position + new Vector3( RoadSpaceParam, 0f, 0f); } else if ((type == RoadType.RightToDown) && (_lastRoadItem.Type == RoadType.LeftToUp)) { position = _lastRoadItem.transform.position + new Vector3( 0f, -RoadSpaceParam, 0f); } else if ((type == RoadType.DownToLeft) && (_lastRoadItem.Type == RoadType.UpToRight)) { position = _lastRoadItem.transform.position + new Vector3( -RoadSpaceParam, 0f, 0f); } else if ((type == RoadType.LeftToUp) && (_lastRoadItem.Type == RoadType.RightToDown)) { position = _lastRoadItem.transform.position + new Vector3( 0f, RoadSpaceParam, 0f); } } return(position); }
/// <summary> /// Reset the road to make the road of type can pass /// </summary> /// <returns>The to pass.</returns> /// <param name="type">Type.</param> public void ResetToPass(RoadType type) { if (type == RoadType.North || type == RoadType.South) { timer = 0; trafficLightScript.isPassingNS = true; } if (type == RoadType.West || type == RoadType.East) { timer = PassRate * PassCycle; trafficLightScript.isPassingNS = false; } }
void AutoCreateRoad() { Road[] roofLastRoads = new Road[lastRoads.Count]; lastRoads.CopyTo(roofLastRoads); foreach (Road r in roofLastRoads) { if (r == currentRoad) { RoadType randomRT = (RoadType)System.Enum.ToObject(typeof(RoadType), Random.Range(0, 2)); RoadCreateFromI(r, randomRT, currentRoad.propertyType); } } }
private void TriggerGetDown(RoadType ps) { animator.SetTrigger("trigGetDown"); a_running = false; canChangeRoad = false; speedController.Stop(); if (RecoverGameCoroutine != null) { StopCoroutine(RecoverGameCoroutine); } RecoverGameCoroutine = StartCoroutine(Recover2Game(ps)); }
private void CreateGameObject(RoadType kind, MeshData meshdata, Transform parent) { var go = new GameObject(kind + " Road"); var mesh = go.AddComponent <MeshFilter>().mesh; go.AddComponent <MeshRenderer>(); mesh.vertices = meshdata.Vertices.ToArray(); mesh.triangles = meshdata.Indices.ToArray(); mesh.RecalculateNormals(); go.GetComponent <MeshRenderer>().material = FactorySettings.GetSettingsFor <RoadSettings>(kind).Material; go.transform.position += Vector3.up * Order; go.transform.SetParent(parent, true); }
public void CompareTo_TestOfInputAndResultWhenParsedWithTwoDifferentSpeedValues() { // ARRANGE var rt = new RoadType("Motorvej", 100); var rt1 = new RoadType("MiscVej", 60); // ACT var result = rt1.CompareTo(rt1); var result2 = rt.CompareTo(rt1); // ASSERT Assert.AreEqual(0, result); Assert.AreEqual(1, result2); }
public RoadData(RoadType roadtype, Dictionary<string, double> speeddictionary, Color roadcolor, Color linecolor, int forwardlanecount, int backwardlanecount, bool forwardshoulder, bool backwardshoulder, double lanewidth, double dashlength, double dashwidth, double gaplength) { BackwardLaneCount = backwardlanecount; BackwardShoulder = backwardshoulder; DashLength = dashlength; DashWidth = dashwidth; ForwardLaneCount = forwardlanecount; ForwardShoulder = forwardshoulder; GapLength = gaplength; LaneWidth = lanewidth; LineColor = linecolor; RoadColor = roadcolor; RoadType = roadtype; SpeedDictionary = speeddictionary; }
public Vehicle(List<GameObject> roadSpriteList, RoadType roadType) { _vehicleType = Resource.getRandomVehicleType(roadType); _bufferInterval = Resource.getVehicleSpace (roadType); _speed = Resource.getSpeed(_vehicleType); _delta = 0f; _roadSpriteList = roadSpriteList; _vehicleSpriteList = new List<GameObject> (); _lineList = new List<LineRenderer> (); List<GameObject> prefabs = Resource.getVehiclePrefabs (_vehicleType); for (int i = 0; i < prefabs.Count; i++) { // vehicle GameObject vehicle = GameObject.Instantiate(prefabs[i], _roadSpriteList[0].transform.position, Quaternion.identity) as GameObject; Vector3 localScale = vehicle.transform.localScale; localScale.x *= -1f; vehicle.transform.localScale = localScale; vehicle.GetComponent<SpriteRenderer> ().sortingOrder = 1; _vehicleSpriteList.Add(vehicle); // line if (i > 0) { GameObject line = GameObject.Instantiate(Resource.getPrefab("Line"), Vector3.zero, Quaternion.identity) as GameObject; LineRenderer lineRenderer = line.GetComponent<LineRenderer>(); lineRenderer.SetVertexCount(2); lineRenderer.SetColors(Color.black, Color.black); lineRenderer.SetPosition(0, _vehicleSpriteList[i-1].transform.position); lineRenderer.SetPosition(1, _vehicleSpriteList[i].transform.position); _lineList.Add(lineRenderer); } } // se _clip = Resource.getSePrefab (_vehicleType); playSound(); }
public static VehicleType getRandomVehicleType(RoadType rType) { VehicleType vType = VehicleType.ROAD_CAR; switch (rType) { case RoadType.ROAD: vType = (VehicleType)UnityEngine.Random.Range(0, (int)VehicleType.RAIL_SHINKANSEN); break; case RoadType.RAIL: vType = (VehicleType)UnityEngine.Random.Range((int)VehicleType.RAIL_SHINKANSEN, (int)VehicleType.LENGTH); break; } return vType; }
public static GameObject getRoadPrefab(RoadType rType) { GameObject obj = null; switch(rType) { case RoadType.ROAD: obj = getPrefab("Road"); break; case RoadType.RAIL: obj = getPrefab("Rail"); break; } return obj; }
public static string GetRoadConditionStyleID(RoadType rdtype) { string styleID = "#greenLine"; switch (rdtype) { case RoadType.Good: case RoadType.Idle: styleID = "#greenLine"; break; case RoadType.SlightyBumpy: styleID = "#yellowLine"; break; case RoadType.Bumpy: styleID = "#yellowLine"; break; case RoadType.Worst: styleID = "#redLine"; break; case RoadType.RandomAction: styleID = "#blueLine"; break; default: styleID = "#blackLine"; break; } return styleID; }
public void initialize(CameraManager cameraManager) { _cameraManager = cameraManager; _roadType = Resource.getRandomRoadType(); }
public GPXData ProcessDataForGPX() { if (_sensorDataSet.Count == 0) return new GPXData(); List<float> yawList = new List<float>(); List<float> rollList = new List<float>(); List<float> pitchList = new List<float>(); foreach (var sensData in _sensorDataSet) { yawList.Add(sensData.Yaw); rollList.Add(sensData.Roll); pitchList.Add(sensData.Pitch); } _sdDevPitch = getStandardDeviation(pitchList); _sdDevRoll = getStandardDeviation(rollList); _sdDevYaw = getStandardDeviation(yawList); if (double.IsNaN(_sdDevRoll)) { _sdDevRoll = 0; } if (double.IsNaN(_sdDevYaw)) { _sdDevYaw = 0; } if (double.IsNaN(_sdDevPitch)) { _sdDevPitch = 0; } _rdType = GetRoadType(); int lastDS = _sensorDataSet.Count - 1; return new GPXData() { StartLat = _sensorDataSet[0].Lat, StartLog = _sensorDataSet[0].Log, EndLat = _sensorDataSet[lastDS].Lat, EndLog = _sensorDataSet[lastDS].Log, RoadCondition = _rdType, ActualRoadCondition = _sensorDataSet[lastDS].ActualRoadCondition, StdDevPitch = _sdDevPitch, StdDevRoll = _sdDevRoll, StdDevYaw = _sdDevYaw, Speed = _sensorDataSet[lastDS].Speed, Time = _sensorDataSet[lastDS].Time }; }
public override void OnInspectorGUI() { DrawDefaultInspector(); if(!TrafficSystem || !TrafficSystem.Instance) return; GUILayout.BeginHorizontal("box"); TrafficSystem.Instance.RoadQualityElementsIndex = EditorGUILayout.Popup(TrafficSystem.Instance.RoadQualityElementsIndex, m_roadQualityElements); if(GUILayout.Button("Apply Road Quality")) { ChangeRoadQuality(); } GUILayout.EndHorizontal(); GUILayout.Space(10.0f); if(!EditTrafficSystemPiece) { GUILayout.Label ("Road Pieces", EditorStyles.boldLabel); // TrafficSystem.Instance.m_autoLinkOnSpawn = GUILayout.Toggle(TrafficSystem.Instance.m_autoLinkOnSpawn, " Auto Link On Spawn"); // TrafficSystem.Instance.m_quickSpawn = GUILayout.Toggle(TrafficSystem.Instance.m_quickSpawn, " Quick Spawn"); if(EditTrafficSystemPiece && GUILayout.Button("Go to 'Edit' Piece")) Selection.activeObject = EditTrafficSystemPiece.transform; if(AnchorTrafficSystemPiece && GUILayout.Button("Go to 'Anchor' Piece")) Selection.activeObject = AnchorTrafficSystemPiece.transform; GUILayout.Space(10.0f); GUILayout.BeginHorizontal("box"); if(TrafficSystem.Instance.TextureIconRoadTypeAll) { if(GUILayout.Button(TrafficSystem.Instance.TextureIconRoadTypeAll)) m_roadTypeSelected = RoadType.ALL; } else { if(GUILayout.Button("All")) m_roadTypeSelected = RoadType.ALL; } if(TrafficSystem.Instance.TextureIconRoadType0Lanes) { if(GUILayout.Button(TrafficSystem.Instance.TextureIconRoadType0Lanes)) m_roadTypeSelected = RoadType.LANES_0; } else { if(GUILayout.Button("0 Lanes")) m_roadTypeSelected = RoadType.LANES_0; } if(TrafficSystem.Instance.TextureIconRoadType1Lane) { if(GUILayout.Button(TrafficSystem.Instance.TextureIconRoadType1Lane)) m_roadTypeSelected = RoadType.LANES_1; } else { if(GUILayout.Button("1 Lane")) m_roadTypeSelected = RoadType.LANES_1; } if(TrafficSystem.Instance.TextureIconRoadType2Lanes) { if(GUILayout.Button(TrafficSystem.Instance.TextureIconRoadType2Lanes)) m_roadTypeSelected = RoadType.LANES_2; } else { if(GUILayout.Button("2 Lanes")) m_roadTypeSelected = RoadType.LANES_2; } if(TrafficSystem.Instance.TextureIconRoadType4Lanes) { if(GUILayout.Button(TrafficSystem.Instance.TextureIconRoadType4Lanes)) m_roadTypeSelected = RoadType.LANES_4; } else { if(GUILayout.Button("4 Lanes")) m_roadTypeSelected = RoadType.LANES_4; } if(TrafficSystem.Instance.TextureIconRoadType6Lanes) { if(GUILayout.Button(TrafficSystem.Instance.TextureIconRoadType6Lanes)) m_roadTypeSelected = RoadType.LANES_6; } else { if(GUILayout.Button("6 Lanes")) m_roadTypeSelected = RoadType.LANES_6; } GUILayout.EndHorizontal(); GUILayout.Space(10.0f); int btnColCount = 1; int btnColCloseCount = 0; bool hasOpened = false; for(int aIndex = 0; aIndex < m_trafficSystemRoadPiecesLocation.Length; aIndex++) { string file = m_trafficSystemRoadPiecesLocation[aIndex].Substring(m_dirRoadPieces.Length, m_trafficSystemRoadPiecesLocation[aIndex].Length - m_dirRoadPieces.Length - 7); if(file.Contains("( Road V2 )")) file = file.ToString() + " NEW"; if(m_roadTypeSelected == RoadType.LANES_0) { if(!file.Contains("0 Lane")) continue; } else if(m_roadTypeSelected == RoadType.LANES_1) { if(!file.Contains("1 Lane")) continue; } else if(m_roadTypeSelected == RoadType.LANES_2) { if(!file.Contains("2 Lane")) continue; } else if(m_roadTypeSelected == RoadType.LANES_4) { if(!file.Contains("4 Lane")) continue; } else if(m_roadTypeSelected == RoadType.LANES_6) { if(!file.Contains("6 Lane")) continue; } if(aIndex % btnColCount == 0) { hasOpened = true; GUILayout.BeginHorizontal("box"); btnColCloseCount = 0; } if(GUILayout.Button(file)) { ProcessFolderChecks(); TrafficSystemPiece roadPiece = AssetDatabase.LoadAssetAtPath(m_trafficSystemRoadPiecesLocation[aIndex], typeof(TrafficSystemPiece)) as TrafficSystemPiece; if(roadPiece) { TrafficSystemPiece roadPieceClone = PrefabUtility.InstantiatePrefab(roadPiece) as TrafficSystemPiece; if(roadPieceClone) { roadPieceClone.name = m_trafficSystemPieceCount + " - " + roadPieceClone.name; // Vector3 posOffset = roadPieceClone.m_posOffset; // if(AnchorTrafficSystemPiece) // { // Vector3 dir = AnchorTrafficSystemPiece.transform.position - roadPieceClone.transform.position; // dir = dir.normalized; // posOffset.x = posOffset.x * dir.x; // posOffset.y = posOffset.y * dir.y; // posOffset.z = posOffset.z * dir.z; // } roadPieceClone.transform.position = Vector3.zero; roadPieceClone.transform.rotation = Quaternion.identity; roadPieceClone.transform.localScale = TrafficSystem.m_roadScale * roadPieceClone.transform.localScale; m_trafficSystemPieceCount++; SetTrafficSystemPiece( TrafficSystem.TrafficSystemTooltip.EDIT, roadPieceClone ); if(TrafficSystem.Instance) TrafficSystem.Instance.ShowTooltip( TrafficSystem.TrafficSystemTooltip.EDIT, true ); if(AnchorTrafficSystemPiece) { PositionTrafficSystemPiece(EditTrafficSystemPiece, AnchorTrafficSystemPiece, false); FirstNode = false; } else { SetTrafficSystemPiece( TrafficSystem.TrafficSystemTooltip.ANCHOR, EditTrafficSystemPiece ); FirstNode = true; } if(TrafficSystem.Instance.m_autoLinkOnSpawn) { CreateAllLinks( true ); } // position if(TrafficSystem) { roadPieceClone.transform.parent = TrafficSystem.transform; UpdateEditTrafficSystemPiecePos(); // set the quality of the road if(TrafficSystem.Instance && TrafficSystem.Instance.m_spawnWithRoadQuality) roadPieceClone.ProcessRoadQuality( TrafficSystem.Instance.GetRoadQualityVal() ); } if(TrafficSystem.Instance.m_quickSpawn) { SetTrafficSystemPiece( TrafficSystem.TrafficSystemTooltip.ANCHOR, EditTrafficSystemPiece ); SetTrafficSystemPiece( TrafficSystem.TrafficSystemTooltip.EDIT, null ); if(TrafficSystem.Instance) TrafficSystem.Instance.ShowTooltip( TrafficSystem.TrafficSystemTooltip.EDIT, false ); } } } } btnColCloseCount++; if(btnColCloseCount == btnColCount) { hasOpened = false; GUILayout.EndHorizontal(); btnColCloseCount = 0; } } if(hasOpened) GUILayout.EndHorizontal(); } else { GUILayout.Label ("Road Piece Options", EditorStyles.boldLabel); EditorGUILayout.LabelField("Road Attachment Point: " + m_roadAttachmentPointIndex); GUILayout.Space(10.0f); EditorGUILayout.LabelField("Edit : " + EditTrafficSystemPiece); EditorGUILayout.LabelField("Anchor : " + AnchorTrafficSystemPiece); GUILayout.Space(10.0f); if(AnchorTrafficSystemPiece && GUILayout.Button("View 'Anchor' Piece " + AnchorTrafficSystemPiece.name)) Selection.activeObject = AnchorTrafficSystemPiece.transform; if(EditTrafficSystemPiece && GUILayout.Button("View 'Edit' Piece " + EditTrafficSystemPiece.name)) Selection.activeObject = EditTrafficSystemPiece.transform; GUILayout.Space(10.0f); if(!FirstNode) { GUILayout.BeginHorizontal("box"); TrafficSystem.Instance.m_swapAnchorDimensions = GUILayout.Toggle(TrafficSystem.Instance.m_swapAnchorDimensions, " Flip 'Anchor' Renderer Size ."); TrafficSystem.Instance.m_swapEditDimensions = GUILayout.Toggle(TrafficSystem.Instance.m_swapEditDimensions, " Flip 'Edit' Renderer Size"); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal("box"); // TrafficSystem.Instance.m_swapOffsetDir = GUILayout.Toggle(TrafficSystem.Instance.m_swapOffsetDir, " Flip Offset Dir ."); TrafficSystem.Instance.m_swapOffsetSize = GUILayout.Toggle(TrafficSystem.Instance.m_swapOffsetSize, " Flip Offset Size (x -> z, z -> x) ."); TrafficSystem.Instance.m_negateOffsetSize = GUILayout.Toggle(TrafficSystem.Instance.m_negateOffsetSize, " Negate Offset Size (-x, -y, -z)"); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.BeginVertical("box"); if(GUILayout.Button("Next Attachment Point")) PositionTrafficSystemPiece(EditTrafficSystemPiece, AnchorTrafficSystemPiece); if(GUILayout.Button("Next Attachment Point Using 'Edit' Offset")) PositionTrafficSystemPiece(EditTrafficSystemPiece, AnchorTrafficSystemPiece, true, true); if(GUILayout.Button("Next Attachment Point Using 'Anchor' Offset")) PositionTrafficSystemPiece(EditTrafficSystemPiece, AnchorTrafficSystemPiece, true, false, true); GUILayout.EndHorizontal(); } GUILayout.BeginHorizontal("box"); if(GUILayout.Button("Rot Y (" + m_rotateDegrees + ")")) { EditTrafficSystemPiece.transform.Rotate(Vector3.up * m_rotateDegrees); } if(GUILayout.Button("Rot Z (" + (m_rotateDegrees * 2) + ")")) { EditTrafficSystemPiece.transform.Rotate(Vector3.forward * (m_rotateDegrees * 2)); } if(GUILayout.Button("Flip (X)")) { Vector3 scale = EditTrafficSystemPiece.transform.localScale; scale.x = -scale.x; EditTrafficSystemPiece.transform.localScale = scale; } if(GUILayout.Button("Flip (Z)")) { Vector3 scale = EditTrafficSystemPiece.transform.localScale; scale.z = -scale.z; EditTrafficSystemPiece.transform.localScale = scale; } // if(GUILayout.Button("Flip Z")) // { // Vector3 scale = EditTrafficSystemPiece.transform.localScale; // scale.z = -scale.z; // EditTrafficSystemPiece.transform.localScale = scale; // } GUILayout.EndHorizontal(); if(EditTrafficSystemPiece != AnchorTrafficSystemPiece) { GUILayout.Space(15.0f); GUILayout.BeginHorizontal("box"); if(GUILayout.Button("Reveal All ('A' to 'E')")) { CreateAllLinks(true, true); } if(GUILayout.Button("Reveal All ('E' to 'A')")) { CreateAllLinks(false, true); } if(GUILayout.Button("Reveal All ('A' to 'E') Same Lane")) { CreateAllLinks(true, true, true); } if(GUILayout.Button("Reveal All ('E' to 'A') Same Lane")) { CreateAllLinks(false, true, true); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal("box"); if(GUILayout.Button("Link All ('A' to 'E')")) { CreateAllLinks(true); } if(GUILayout.Button("Link All ('E' to 'A')")) { CreateAllLinks(false); } if(GUILayout.Button("Link All ('A' to 'E') Same Lane")) { CreateAllLinks(true, false, true); } if(GUILayout.Button("Link All ('E' to 'A') Same Lane")) { CreateAllLinks(false, false, true); } GUILayout.EndHorizontal(); GUILayout.Space(15.0f); GUILayout.BeginHorizontal("box"); if(GUILayout.Button("Reveal Opposite ('A' to 'E')")) { CreateOppositeLinks( true, true ); } if(GUILayout.Button("Reveal Opposite ('E' to 'A')")) { CreateOppositeLinks( false, true ); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal("box"); if(GUILayout.Button("Link Opposite ('A' to 'E')")) { CreateOppositeLinks( true ); } if(GUILayout.Button("Link Opposite ('E' to 'A')")) { CreateOppositeLinks( false ); } GUILayout.EndHorizontal(); GUILayout.Space(15.0f); GUILayout.BeginHorizontal("box"); if(GUILayout.Button("Reveal (Blue - 'A' to 'E')")) { CreateLeftLinks(true, true); } if(GUILayout.Button("Reveal (Blue - 'E' to 'A')")) { CreateLeftLinks(false, true); } if(GUILayout.Button("Reveal (Pink - 'A' to 'E')")) { CreateRightLink(true, true); } if(GUILayout.Button("Reveal (Pink - 'E' to 'A')")) { CreateRightLink(false, true); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal("box"); if(GUILayout.Button("Link (Blue - 'A' to 'E')")) { CreateLeftLinks(true); } if(GUILayout.Button("Link (Blue - 'E' to 'A')")) { CreateLeftLinks(false); } if(GUILayout.Button("Link (Pink - 'A' to 'E')")) { CreateRightLink(true); } if(GUILayout.Button("Link (Pink - 'E' to 'A')")) { CreateRightLink(false); } GUILayout.EndHorizontal(); GUILayout.Space(15.0f); for(int bIndex = 0; bIndex < EditTrafficSystemPiece.m_leftLaneChangeNodes.Count; bIndex++) { TrafficSystemNode node = EditTrafficSystemPiece.m_leftLaneChangeNodes[bIndex]; if(node && node.m_isInbound) { GUILayout.BeginHorizontal("box"); GUILayout.Label("Link CL Inbound: "); if(GUILayout.Button("Reveal ->")) { CreateAllChangeLaneLinks( true, TrafficSystem.DriveSide.LEFT, (int)node.m_changeLaneID, false, true ); } if(GUILayout.Button("Blue Primary -> Blue " + node.m_changeLaneID )) { CreateAllChangeLaneLinks( true, TrafficSystem.DriveSide.LEFT, (int)node.m_changeLaneID, false ); } if(GUILayout.Button("Reveal ->")) { CreateAllChangeLaneLinks( true, TrafficSystem.DriveSide.LEFT, (int)node.m_changeLaneID, true, true ); } if(GUILayout.Button("Pink Primary -> Blue " + node.m_changeLaneID )) { CreateAllChangeLaneLinks( true, TrafficSystem.DriveSide.LEFT, (int)node.m_changeLaneID, true ); } GUILayout.EndHorizontal(); } } for(int bIndex = 0; bIndex < EditTrafficSystemPiece.m_rightLaneChangeNodes.Count; bIndex++) { TrafficSystemNode node = EditTrafficSystemPiece.m_rightLaneChangeNodes[bIndex]; if(node && node.m_isInbound) { GUILayout.BeginHorizontal("box"); GUILayout.Label("Link CL Inbound: "); if(GUILayout.Button("Reveal ->")) { CreateAllChangeLaneLinks( true, TrafficSystem.DriveSide.RIGHT, (int)node.m_changeLaneID, false, true ); } if(GUILayout.Button("Pink Primary -> Pink " + node.m_changeLaneID)) { CreateAllChangeLaneLinks( true, TrafficSystem.DriveSide.RIGHT, (int)node.m_changeLaneID, false ); } if(GUILayout.Button("Reveal ->")) { CreateAllChangeLaneLinks( true, TrafficSystem.DriveSide.RIGHT, (int)node.m_changeLaneID, true, true ); } if(GUILayout.Button("Blue Primary -> Pink " + node.m_changeLaneID)) { CreateAllChangeLaneLinks( true, TrafficSystem.DriveSide.RIGHT, (int)node.m_changeLaneID, true ); } GUILayout.EndHorizontal(); } } for(int bIndex = 0; bIndex < AnchorTrafficSystemPiece.m_leftLaneChangeNodes.Count; bIndex++) { TrafficSystemNode node = AnchorTrafficSystemPiece.m_leftLaneChangeNodes[bIndex]; if(node && node.m_isOutbound) { GUILayout.BeginHorizontal("box"); GUILayout.Label("Link CL Outbound: "); if(GUILayout.Button("Reveal ->")) { CreateAllChangeLaneLinks( false, TrafficSystem.DriveSide.LEFT, (int)node.m_changeLaneID, true, true ); } if(GUILayout.Button("Blue " + node.m_changeLaneID + " -> Blue Primary")) { CreateAllChangeLaneLinks( false, TrafficSystem.DriveSide.LEFT, (int)node.m_changeLaneID, true ); } if(GUILayout.Button("Reveal ->")) { CreateAllChangeLaneLinks( false, TrafficSystem.DriveSide.LEFT, (int)node.m_changeLaneID, false, true ); } if(GUILayout.Button("Blue " + node.m_changeLaneID + " -> Pink Primary")) { CreateAllChangeLaneLinks( false, TrafficSystem.DriveSide.LEFT, (int)node.m_changeLaneID, false ); } GUILayout.EndHorizontal(); } } for(int bIndex = 0; bIndex < AnchorTrafficSystemPiece.m_rightLaneChangeNodes.Count; bIndex++) { TrafficSystemNode node = AnchorTrafficSystemPiece.m_rightLaneChangeNodes[bIndex]; if(node && node.m_isOutbound) { GUILayout.BeginHorizontal("box"); GUILayout.Label("Link CL Outbound: "); if(GUILayout.Button("Reveal ->")) { CreateAllChangeLaneLinks( false, TrafficSystem.DriveSide.RIGHT, (int)node.m_changeLaneID, true, true ); } if(GUILayout.Button("Pink " + node.m_changeLaneID + " -> Pink Primary")) { CreateAllChangeLaneLinks( false, TrafficSystem.DriveSide.RIGHT, (int)node.m_changeLaneID, true ); } if(GUILayout.Button("Reveal ->")) { CreateAllChangeLaneLinks( false, TrafficSystem.DriveSide.RIGHT, (int)node.m_changeLaneID, false, true ); } if(GUILayout.Button("Pink " + node.m_changeLaneID + " -> Blue Primary")) { CreateAllChangeLaneLinks( false, TrafficSystem.DriveSide.RIGHT, (int)node.m_changeLaneID, false ); } GUILayout.EndHorizontal(); } } /* for(int bIndex = 0; bIndex < (int)TrafficSystemNode.NodeID.ID_MAX; bIndex++) { GUILayout.BeginHorizontal("box"); if(GUILayout.Button("Link CL Inbound " + bIndex + " (Blue)")) { CreateAllChangeLaneLinks( true, TrafficSystem.DriveSide.LEFT, bIndex ); } if(GUILayout.Button("Link CL Outbound " + bIndex + " (Blue)")) { CreateAllChangeLaneLinks( false, TrafficSystem.DriveSide.LEFT, bIndex ); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal("box"); if(GUILayout.Button("Link CL Inbound " + bIndex + " (Pink)")) { CreateAllChangeLaneLinks( true, TrafficSystem.DriveSide.RIGHT, bIndex ); } if(GUILayout.Button("Link CL Outbound " + bIndex + " (Pink)")) { CreateAllChangeLaneLinks( false, TrafficSystem.DriveSide.RIGHT, bIndex ); } GUILayout.EndHorizontal(); } */ } GUILayout.BeginHorizontal("box"); if(GUILayout.Button("UnLink All")) { for(int lNIndex = 0; lNIndex < EditTrafficSystemPiece.m_primaryLeftLaneNodes.Count; lNIndex++) { TrafficSystemNode lastNode = EditTrafficSystemPiece.m_primaryLeftLaneNodes[lNIndex]; lastNode.m_connectedNodes.Clear(); EditorUtility.SetDirty(lastNode); } for(int lNIndex = 0; lNIndex < EditTrafficSystemPiece.m_secondaryLeftLaneNodes.Count; lNIndex++) { TrafficSystemNode lastNode = EditTrafficSystemPiece.m_secondaryLeftLaneNodes[lNIndex]; lastNode.m_connectedNodes.Clear(); EditorUtility.SetDirty(lastNode); } for(int lNIndex = 0; lNIndex < EditTrafficSystemPiece.m_primaryRightLaneNodes.Count; lNIndex++) { TrafficSystemNode lastNode = EditTrafficSystemPiece.m_primaryRightLaneNodes[lNIndex]; lastNode.m_connectedNodes.Clear(); EditorUtility.SetDirty(lastNode); } for(int lNIndex = 0; lNIndex < EditTrafficSystemPiece.m_secondaryRightLaneNodes.Count; lNIndex++) { TrafficSystemNode lastNode = EditTrafficSystemPiece.m_secondaryRightLaneNodes[lNIndex]; lastNode.m_connectedNodes.Clear(); EditorUtility.SetDirty(lastNode); } } if(GUILayout.Button("UnLink (Blue)")) { for(int lNIndex = 0; lNIndex < EditTrafficSystemPiece.m_primaryLeftLaneNodes.Count; lNIndex++) { TrafficSystemNode lastNode = EditTrafficSystemPiece.m_primaryLeftLaneNodes[lNIndex]; lastNode.m_connectedNodes.Clear(); EditorUtility.SetDirty(lastNode); } for(int lNIndex = 0; lNIndex < EditTrafficSystemPiece.m_secondaryLeftLaneNodes.Count; lNIndex++) { TrafficSystemNode lastNode = EditTrafficSystemPiece.m_secondaryLeftLaneNodes[lNIndex]; lastNode.m_connectedNodes.Clear(); EditorUtility.SetDirty(lastNode); } } if(GUILayout.Button("UnLink (Pink)")) { for(int lNIndex = 0; lNIndex < EditTrafficSystemPiece.m_primaryRightLaneNodes.Count; lNIndex++) { TrafficSystemNode lastNode = EditTrafficSystemPiece.m_primaryRightLaneNodes[lNIndex]; lastNode.m_connectedNodes.Clear(); EditorUtility.SetDirty(lastNode); } for(int lNIndex = 0; lNIndex < EditTrafficSystemPiece.m_secondaryRightLaneNodes.Count; lNIndex++) { TrafficSystemNode lastNode = EditTrafficSystemPiece.m_secondaryRightLaneNodes[lNIndex]; lastNode.m_connectedNodes.Clear(); EditorUtility.SetDirty(lastNode); } } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal("box"); if(GUILayout.Button("Delete")) { DestroyImmediate(EditTrafficSystemPiece.gameObject); SetTrafficSystemPiece( TrafficSystem.TrafficSystemTooltip.EDIT, null ); } GUILayout.EndHorizontal(); GUILayout.Space(10.0f); if(EditTrafficSystemPiece) { if(GUILayout.Button("Save Changes to " + EditTrafficSystemPiece.name)) { // if(EditTrafficSystemPiece && EditTrafficSystemPiece.m_ignoreChildren) // { // List<TrafficSystemPiece> pieces = new List<TrafficSystemPiece>(); // for(int cIndex = 0; cIndex < EditTrafficSystemPiece.transform.childCount; cIndex++) // { // Transform child = EditTrafficSystemPiece.transform.GetChild(cIndex); // if(child.gameObject.GetComponent<TrafficSystemPiece>()) // pieces.Add(child.gameObject.GetComponent<TrafficSystemPiece>()); // } // // for(int cIndex = 0; cIndex < pieces.Count; cIndex++) // pieces[cIndex].transform.parent = TrafficSystem.transform; // } TrafficSystem.ClearCLRevealObjsFrom(); TrafficSystem.ClearCLRevealObjsTo(); SetTrafficSystemPiece( TrafficSystem.TrafficSystemTooltip.ANCHOR, EditTrafficSystemPiece ); SetTrafficSystemPiece( TrafficSystem.TrafficSystemTooltip.EDIT, null ); if(TrafficSystem.Instance) TrafficSystem.Instance.ShowTooltip( TrafficSystem.TrafficSystemTooltip.EDIT, false ); //m_roadAttachmentPointIndex = RoadAttachmentPoint.SOUTH; } } } if(GUI.changed) EditorUtility.SetDirty(TrafficSystem); if(TrafficSystem) { if(EditNodeFolder) { for(int cIndex = 0; cIndex < EditNodeFolder.childCount; cIndex++) EditNodeFolder.GetChild(cIndex).transform.parent = TrafficSystem.transform; if(EditTrafficSystemPiece) { TrafficSystemPiece piece = FindParentTrafficSystemPiece( EditTrafficSystemPiece ); piece.transform.parent = EditNodeFolder; } } if(AnchorNodeFolder) { for(int cIndex = 0; cIndex < AnchorNodeFolder.childCount; cIndex++) AnchorNodeFolder.GetChild(cIndex).transform.parent = TrafficSystem.transform; if(AnchorTrafficSystemPiece) { TrafficSystemPiece piece = FindParentTrafficSystemPiece( AnchorTrafficSystemPiece ); piece.transform.parent = AnchorNodeFolder; } } } // groupEnabled = EditorGUILayout.BeginToggleGroup ("Optional Settings", groupEnabled); // { // myBool = EditorGUILayout.Toggle ("Toggle", myBool); // myFloat = EditorGUILayout.Slider ("Slider", myFloat, -3, 3); // myString = EditorGUILayout.TextField ("Text Field", myString); // } // EditorGUILayout.EndToggleGroup (); }
public static float getVehicleSpace(RoadType rType) { if (rType == RoadType.RAIL) return 8f; else return 0f; }
private void PlayRoadType(RoadType rt) { switch (rt) { case RoadType.Good: break; case RoadType.SlightyBumpy: _mpSBumpy.Start(); break; case RoadType.Bumpy: _mpBumpy.Start(); break; case RoadType.Worst: _mpWorse.Start(); break; case RoadType.RandomAction: break; case RoadType.Idle: break; default: break; } }