private void InitializeComps() { if (def.comps != null) { comps = new List <HediffComp>(); for (int i = 0; i < def.comps.Count; i++) { HediffComp hediffComp = (HediffComp)Activator.CreateInstance(def.comps[i].compClass); hediffComp.props = def.comps[i]; hediffComp.parent = this; comps.Add(hediffComp); } } }
private void InitializeComps() { if (def.comps != null) { comps = new List <HediffComp>(); for (int i = 0; i < def.comps.Count; i++) { HediffComp hediffComp = null; try { hediffComp = (HediffComp)Activator.CreateInstance(def.comps[i].compClass); hediffComp.props = def.comps[i]; hediffComp.parent = this; comps.Add(hediffComp); } catch (Exception arg) { Log.Error("Could not instantiate or initialize a HediffComp: " + arg); comps.Remove(hediffComp); } } } }