internal void UpdateBuildingModel(BuildingModel model) { int id = model.Id; IdDataStruct type = System.Array.Find(buildingTypes, a => a.ID == id); if (type != null) { model.Height = type.height; model.Width = type.width; float r = Random.Range(0f, 1f); model.FlatView = id == -1 ? (r > 0.25f ? park[Random.Range(0, park.Length - 1)] : flat[Random.Range(0, flat.Length - 1)]) : type.flatView; int dens = id != -1 && this.density.Count > id ? this.density[id] : -1; if (id != this.streetViewId) { model.ReleaseStreetView(); } if (id == -1) { model.MeshView = r > 0.25f ? park[Random.Range(0, park.Length - 1)] : flat[Random.Range(0, flat.Length - 1)]; } else if (id == 6 || id == this.streetViewId) { model.MeshView = road[Random.Range(0, road.Length - 1)]; } else if (dens <= this.medDensity) { model.MeshView = type.residential ? residentialLowRise[Random.Range(0, residentialLowRise.Length - 1)] : officeLowRise[Random.Range(0, officeLowRise.Length - 1)]; } else if (dens <= this.highDensity) { model.MeshView = type.residential ? residentialMidRise[Random.Range(0, residentialMidRise.Length - 1)] : officeMidRise[Random.Range(0, officeMidRise.Length - 1)]; } else { model.MeshView = type.residential ? residentialHighRise[Random.Range(0, residentialHighRise.Length - 1)] : officeHighRise[Random.Range(0, officeHighRise.Length - 1)]; } if (id == this.streetViewId) { model.StreetView(); } } model.ChangeIndicator = this.changeIndicator; this.AddModel(model); }