привет помоги с рефакторингом этого кода для unity 
 public class ConstructorPanel : MonoBehaviour
 {
     [SerializeField]
     private List<FrameView> registerBlocks;
     [SerializeField]
     private List<FrameView> registerObstacles;
     [SerializeField]
     private List<FrameView> registerContainers;
     [SerializeField]
     private List<FrameView> registerDevices;

     [SerializeField]
     private MenuConstructor menuConstructor;

     private List<ConstructorType> activeConstructorTypes;
     private Dictionary<ConstructorType, List<FrameView>> registerMap;

     private bool isDisabling = false;

     public void Initialize()
     {
         registerMap = new Dictionary<ConstructorType, List<FrameView>>
         {
             { ConstructorType.registerBlocks, registerBlocks },
             { ConstructorType.registerObstacles, registerObstacles },
             { ConstructorType.registerContainers, registerContainers },
             { ConstructorType.registerDevices, registerDevices }
         };

         activeConstructorTypes = new List<ConstructorType>();

         menuConstructor.Initialized();
         menuConstructor.OnChoiceType += ActivateRegister;
     }

     public void ActivateRegister(ConstructorType constructorType)
     {
         if (isDisabling)
             return;

         DeactivateRegisters();

         if (activeConstructorTypes.Contains(constructorType))
         {
             activeConstructorTypes.Remove(constructorType);
         }
         else
         {
             activeConstructorTypes.Add(constructorType);
         }

         if (activeConstructorTypes.Count == 0)
         {
             SetRegistersActiveState(true, allRegisters: true);
         }
         else
         {
             
             if (activeConstructorTypes.Count > 1)
             {

                 isDisabling = true;
                 menuConstructor.DisablingElement(activeConstructorTypes.First());
                 activeConstructorTypes.Remove(activeConstructorTypes.First());
                 isDisabling = false;
             }

             SetRegistersActiveState(true, constructorType);
         }
     }

     private void ActivateChoiceTypeRegister(ConstructorType constructorType)
     {
         DeactivateRegisters();
         SetRegistersActiveState(true, constructorType);
     }

     private void SetRegistersActiveState(bool state, ConstructorType? type = null, bool allRegisters = false)
     {
         if (allRegisters)
         {
             foreach (var registers in registerMap.Values)
             {
                 foreach (var register in registers)
                 {
                     register.gameObject.SetActive(state);
                 }
             }
         }
         else if (type.HasValue)
         {
             foreach (var register in registerMap[type.Value])
             {
                 register.gameObject.SetActive(state);
             }
         }
     }

     private void DeactivateRegisters()
     {
         SetRegistersActiveState(false, allRegisters: true);
     }

     public void Remove()
     {
         menuConstructor.OnChoiceType -= ActivateRegister;
         menuConstructor.Remove();
     }
 }