private void FillComponents() { this.components.RemoveAll((MapComponent component) => component == null); foreach (Type item2 in typeof(MapComponent).AllSubclassesNonAbstract()) { if (this.GetComponent(item2) == null) { MapComponent item = (MapComponent)Activator.CreateInstance(item2, this); this.components.Add(item); } } this.roadInfo = this.GetComponent <RoadInfo>(); this.waterInfo = this.GetComponent <WaterInfo>(); }
private void FillComponents() { components.RemoveAll((MapComponent component) => component == null); foreach (Type item2 in typeof(MapComponent).AllSubclassesNonAbstract()) { if (GetComponent(item2) == null) { try { MapComponent item = (MapComponent)Activator.CreateInstance(item2, this); components.Add(item); } catch (Exception ex) { Log.Error(string.Concat("Could not instantiate a MapComponent of type ", item2, ": ", ex)); } } } roadInfo = GetComponent <RoadInfo>(); waterInfo = GetComponent <WaterInfo>(); }