public void AddWorkPackage(WorkPackageDef package) { if (!workPackages.Contains(package)) { workTypesCache = null; powerNeedsCache = null; RefreshWorkGiverCaches(); workPackages.Add(package); if (package.specialistWorker != null) { SpecialistWorker worker = (SpecialistWorker)Activator.CreateInstance(package.specialistWorker, new object[] { parent }); specialist.AddWorker(worker); } } }
public void AddWorker(SpecialistWorker worker) { bool flag = false; foreach (var w in specialistWorkers) { if (worker.GetType() == w.GetType()) { flag = true; break; } } if (!flag) { specialistWorkers.Add(worker); } }