Привет у меня есть несколько скриптов в UnIty помоги с рефакторингом 
public class ModalWindow : MonoBehaviour
{
    [SerializeField]
    private SectionPanelMenu exitScene;
    [SerializeField]
    private SectionPanelMenu offComplex;

    public event Action OnCancelSelection;
    public event Action OnExitApplication;
    public event Action OnOffComplex;

    public void Initialize()
    {
        exitScene.gameObject.SetActive(false);
        offComplex.gameObject.SetActive(false);

        exitScene.Initialize();

        exitScene.OnSwitchOneMode += CancelSelection;
        exitScene.OnSwitchTwoMode += ExitApplication;

        offComplex.Initialize();
            
        offComplex.OnSwitchOneMode += CancelSelection;
        offComplex.OnSwitchTwoMode += OffComplex;
    }

    private void CancelSelection()
    {
        exitScene.gameObject.SetActive(false);
        offComplex.gameObject.SetActive(false);
        OnCancelSelection?.Invoke();
    }

    private void ExitApplication()
    {
        OnExitApplication?.Invoke();
    }

    private void OffComplex()
    {
        OnOffComplex?.Invoke();
        CancelSelection();
    }

    public void ActivateExitMenu()
    {
        exitScene.gameObject.SetActive(true);
    }

    public void ActivateOffComplexMenu()
    {
        offComplex.gameObject.SetActive(true);
    }

    public void Remove()
    {
        exitScene.Remove();
        offComplex.Remove();    
    }
}

public class SectionPanelMenu : MonoBehaviour
{
    [SerializeField]
    InteractiveElements interactiveElementsOne;
    [SerializeField]
    InteractiveElements interactiveElementsTwo;

    public event Action OnSwitchOneMode;
    public event Action OnSwitchTwoMode;

    public void Initialize()
    {
        interactiveElementsOne.OnClick += SwitchOneMode;
        interactiveElementsTwo.OnClick += SwitchTwoMode;
    }

    public void Remove()
    {
        interactiveElementsOne.OnClick -= SwitchOneMode;
        interactiveElementsTwo.OnClick -= SwitchTwoMode;
    }

    private void SwitchOneMode()
    {
        OnSwitchOneMode.Invoke();
    }

    private void SwitchTwoMode()
    {
        OnSwitchTwoMode.Invoke();
    }
}

public class InteractiveElements : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler, IPointerClickHandler
{
    [SerializeField]
    private Image imageCurrent;
    [SerializeField]    
    private Color hoverColor;

    private Color originalColor;

    public event Action OnClick;

    private void Start()
    {
        if (imageCurrent != null)
        {
            originalColor = imageCurrent.color;
        }
    }

    public void OnPointerEnter(PointerEventData eventData)
    {
        if (imageCurrent != null)
        {
            imageCurrent.color = hoverColor;
        }
    }

    public void OnPointerExit(PointerEventData eventData)
    {
        if (imageCurrent != null)
        {
            imageCurrent.color = originalColor;
        }
    }

    public void OnPointerClick(PointerEventData eventData)
    {
        OnClick?.Invoke();
    }
}

  public class MainMenuWindow : UIWindowBase, IMainMenuWindow
  {
      [SerializeField]
      private SectionPanelMenu sectionPanelMenu;
      [SerializeField]
      private SectionPanelMenu applicationPanelMenu;
      [SerializeField]
      private PanelParameters panelParameters;
      [SerializeField]
      private ModalWindow modalWindow;

      private CreateMenu createMenu;

      private void Start()
      {
          createMenu = container.Resolve<CreateMenu>();

          sectionPanelMenu.Initialize();
          sectionPanelMenu.OnSwitchOneMode += SwitchCameraMenu;
          sectionPanelMenu.OnSwitchTwoMode += SwitchDesignerMenu;

          applicationPanelMenu.Initialize();
          applicationPanelMenu.OnSwitchOneMode += TurnOffControlSystem;
          applicationPanelMenu.OnSwitchTwoMode += ShowModalWindowExitApplication;

          panelParameters.Initialize();

          modalWindow.Initialize();
          modalWindow.OnExitApplication += ExitApplication;
          modalWindow.OnCancelSelection += HideModalWindow;
          modalWindow.OnOffComplex += OffComplex;
      }

      private void OffComplex()
      {
          //выключает всю системы света дыма звуков и взаимодействия препятствий.

      }

      private void ExitApplication()
      {
          Debug.Log("ExitApp");
      }

      private void SwitchDesignerMenu()
      {
          createMenu.CreateDesignerMenu();
      }

      private void SwitchCameraMenu()
      {
          createMenu.CreateCameraMenu();
      }

      private void TurnOffControlSystem()
      {
          modalWindow.gameObject.SetActive(true);
          modalWindow.ActivateOffComplexMenu();
      }

      private void ShowModalWindowExitApplication()
      {
          modalWindow.gameObject.SetActive(true);
          modalWindow.ActivateExitMenu();
      }

      private void HideModalWindow()
      {
          modalWindow.gameObject.SetActive(false);
      }

      protected override void OnRemove()
      {
          base.OnRemove();

          sectionPanelMenu.OnSwitchOneMode -= SwitchCameraMenu;
          sectionPanelMenu.OnSwitchTwoMode -= SwitchDesignerMenu;
          sectionPanelMenu.Remove();

          applicationPanelMenu.OnSwitchOneMode -= TurnOffControlSystem;
          applicationPanelMenu.OnSwitchOneMode -= ShowModalWindowExitApplication;
          applicationPanelMenu.Remove();

          panelParameters.Remove();

          modalWindow.Remove();
          modalWindow.OnExitApplication -= ExitApplication;
          modalWindow.OnCancelSelection -= HideModalWindow;
          modalWindow.OnOffComplex -= OffComplex;
      }
  }