Пример #1
0
 internal static void ChangeProcess(UF_Process processToTarget, UF_Process process)
 {
     foreach (Thing thing in Find.Selector.SelectedObjects.OfType <Thing>())
     {
         CompUniversalFermenter comp = thing.TryGetComp <CompUniversalFermenter>();
         if (comp != null && comp.CurrentProcess == processToTarget)
         {
             comp.CurrentProcess = process;
         }
     }
 }
        // This is only called whenever user changes process, which is seldom.
        static void UF_Process_SyncWorker(SyncWorker sync, ref UF_Process obj)
        {
            if (sync.isWriting)
            {
                sync.Write(obj.uniqueID);
            }
            else
            {
                int id = sync.Read <int>();

                obj = UF_Utility.allUFProcesses.First(p => p.uniqueID == id);
            }
        }