コード例 #1
0
 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);
         }
     }
 }
コード例 #2
0
        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);
            }
        }