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 Dictionary <string, CableComponent> GetAllCables()
    {
        SetCablePrefabList();

        foreach (GameObject g in _cablePrefabs)
        {
            CableComponent componentComponent = g.GetComponentInChildren <CableComponent>(true);
            if (!_cableList.ContainsKey(DeviceComponentHelper.ComponentName(componentComponent.componentType)))
            {
                _cableList.Add(DeviceComponentHelper.ComponentName(componentComponent.componentType), componentComponent);
            }
        }

        return(_cableList);
    }
    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;
            }
        }
    }
    void OnTriggerEnter2D(Collider2D col)
    {
        GameObject colliderObj = col.gameObject;

        if (colliderObj.tag == EntranceType())
        {
            if (colliderObj.GetComponent <DragCable>().canDrag&& colliderObj.GetComponent <CableComponent>() != null && DeviceComponentHelper.ComponentName(colliderObj.GetComponent <CableComponent>().componentType) == _componentName)
            {
                //TODO: something saying good job
                //TODO: something about the game logic that is missing... oh ya send info to montage manager
                GameManager.numberOfConections += 1;
                colliderObj.GetComponent <DragCable>().HasConnection();
            }

            else
            {
                //TODO: something happens
            }
        }
    }
 void Awake()
 {
     _componentName = DeviceComponentHelper.ComponentName(componentType);
 }