public void OnBuy()
    {
        if (_isCable)
        {
            if (_uiManager.money >= cableComponent.price)
            {
                if (cableComponent != null)
                {
                    cableComponent.IsAvailabe = true;
                }

                buyButton.interactable = false;
                _uiManager.UpdateMoney(cableComponent.price);

                GameManager.UpdateCableAvailability(DeviceComponentHelper.ComponentName(cableComponent.componentType), true);
            }
        }

        else
        {
            if (_uiManager.money >= deviceComponent.price)
            {
                if (deviceComponent != null)
                {
                    deviceComponent.IsAvailabe = true;
                }

                buyButton.interactable = false;
                _uiManager.UpdateMoney(deviceComponent.price);

                GameManager.UpdateCableAvailability(DeviceComponentHelper.DeviceName(deviceComponent.deviceType), true);
            }
        }
    }
 private void SetAvailableDevices()
 {
     for (int i = 0; i < allDevices.Length; i++)
     {
         if (!availableComponents[DeviceComponentHelper.DeviceName(allDevices[i].deviceType)].IsAvailabe)
         {
             allDevices[i].gameObject.SetActive(false);
         }
     }
 }
    public static Dictionary <string, DeviceComponent> GetAllDevices()
    {
        SetDevicePrefabList();

        foreach (GameObject g in _devicePrefabs)
        {
            DeviceComponent componentComponent = g.GetComponentInChildren <DeviceComponent>(true);
            if (!_deviceList.ContainsKey(DeviceComponentHelper.DeviceName(componentComponent.deviceType)))
            {
                _deviceList.Add(DeviceComponentHelper.DeviceName(componentComponent.deviceType), componentComponent);
            }
        }

        return(_deviceList);
    }
    public static void AddDeviceSelection(DeviceComponent component)
    {
        if (_selectedDevices == null || _selectedDevices.Count == 0)
        {
            _selectedDevices = new List <GameObject>();
        }

        foreach (GameObject g in _devicePrefabs)
        {
            if ((DeviceComponentHelper.DeviceName(g.GetComponentInChildren <DeviceComponent>(true).deviceType) ==
                 DeviceComponentHelper.DeviceName(component.deviceType)) && !_selectedDevices.Contains(g))
            {
                _selectedDevices.Add(g);
                break;
            }
        }
    }