/// <summary> /// Apply to terrain /// </summary> /// <param name="TerrainModifier">The Terrain Modifier helper</param> public void ModifiyTerrain(TerrainModifier tm) { foreach (RoadNetworkNode rnn in _roadNetworkNode.Details.Roads) { string[] stringArray = new string[2] { _roadNetworkNode.name, rnn.name }; Array.Sort(stringArray); string streetFullName = string.Join("-", stringArray); StreetData sd = StreetManager.Instance[streetFullName]; RoadCrossSection rsc = sd.GetFirst; if (rsc == null) { continue; } RoadCrossSection rsca = sd.GetSecond; if (rsca == null) { continue; } tm.ApplyToTerrain(rsc, rsca); } }
/// <summary> /// Add a street to the list /// </summary> /// <param name="streetFullName">The name of the street</param> /// <param name="streetData">The street data</param> /// <returns>True if we have added the street data</returns> public bool Add(string streetFullName, StreetData streetData) { StreetData oldsd = null; if (_streets.TryGetValue(streetFullName, out oldsd)) { return(false); } _streets.Add(streetFullName, streetData); return(true); }
/// <summary> /// Replace the road with the same id /// </summary> /// <param name="nameStart">The first name</param> /// <param name="nameEnd">The second name</param> /// <param name="crossSectionDetails">The cross section details to use</param> /// <param name="roadCrossSection">The replacement cross section</param> public void ReplaceRoadWithId(string nameStart, string nameEnd, ICrossSection crossSectionDetails, RoadCrossSection roadCrossSection) { string[] stringArray = new string[2] { nameStart, nameEnd }; Array.Sort(stringArray); string streetFullName = string.Join("-", stringArray); StreetData street = null; if (_streets.TryGetValue(streetFullName, out street)) { street.ReplaceRoadWith(roadCrossSection, crossSectionDetails); } else { Debug.LogError("SteetData.ReplaceRoadWithId Can't find street to update node on"); } }
/// <summary> /// Add the street end /// </summary> /// <param name="nameStart">The name of the street</param> /// <param name="nameEnd">The second path of the name</param> /// <param name="crossSectionDetails">The cross section details</param> /// <param name="materialFreq">The material frequency details</param> /// <param name="roadCrossSection">The road cross section</param> public void AddStreetEnd(string nameStart, string nameEnd, ICrossSection crossSectionDetails, IMaterialFrequency materialFreq, RoadCrossSection roadCrossSection) { string[] stringArray = new string[2] { nameStart, nameEnd }; Array.Sort(stringArray); string streetFullName = string.Join("-", stringArray); StreetData street = null; if (!_streets.TryGetValue(streetFullName, out street)) { street = new StreetData(roadCrossSection, crossSectionDetails, materialFreq); _streets.Add(streetFullName, street); } else { street.AddSecondRoad(roadCrossSection, crossSectionDetails); } }