示例#1
0
 public void RegisterField(CompPsychicSuppressionField comp)
 {
     foreach (var cell in comp.CellsInRange())
     {
         if (suppressionField.TryGetValue(cell, out var existing))
         {
             existing.Comps.Add(comp);
         }
         else
         {
             var entry = new SuppressionFieldEntry();
             entry.Comps.Add(comp);
             suppressionField.Add(cell, entry);
         }
     }
 }
示例#2
0
        public void UnregisterField(CompPsychicSuppressionField comp)
        {
            var entriesToRemove = new List <IntVec3>();

            foreach (var entry in suppressionField)
            {
                if (!entry.Value.Comps.Contains(comp))
                {
                    continue;
                }

                entry.Value.Comps.Remove(comp);

                if (entry.Value.Comps.Any())
                {
                    continue;
                }

                entriesToRemove.Add(entry.Key);
            }

            entriesToRemove.ForEach(entry => suppressionField.Remove(entry));
        }
示例#3
0
 public void UpdateFieldRadius(CompPsychicSuppressionField comp)
 {
     UnregisterField(comp);
     RegisterField(comp);
 }