public void CreateTower()
    {
        TowerSlot[] towerLocations = path.GetTowerLocations();

        int       randomPos = Random.Range(0, towerLocations.Length);
        TowerSlot randomlySelectedLocation = towerLocations[randomPos];

        if (randomlySelectedLocation.IsOccupied)
        {
            for (int i = randomPos + 1; i < towerLocations.Length; i++)
            {
                if (!towerLocations[i].IsOccupied)
                {
                    randomlySelectedLocation = towerLocations[i];
                    Tower tower = Instantiate(towerPrototype, randomlySelectedLocation.Position, Quaternion.identity);
                    tower.SetTowerProperties(Random.Range(Constants.MIN_TOWER_POWER, Constants.MAX_TOWER_POWER));

                    randomlySelectedLocation.SetTower(tower);
                    return;
                }
            }
        }
        else
        {
            Tower tower = Instantiate(towerPrototype, randomlySelectedLocation.Position, Quaternion.identity);
            tower.SetTowerProperties(Random.Range(Constants.MIN_TOWER_POWER, Constants.MAX_TOWER_POWER));

            randomlySelectedLocation.SetTower(tower);
            return;
        }

        Debug.Log("Cant put tower");
    }
    void Update()
    {
        if (EventSystem.current.IsPointerOverGameObject())
        {
            return;
        }

        if (Input.GetMouseButtonUp(0))
        {
            Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit;
            if (Physics.Raycast(ray, out hit, Mathf.Infinity, groundMask))
            {
                if (selectedtower != null)
                {
                    TowerSlot ts = hit.transform.gameObject.GetComponent <TowerSlot>();
                    if (ts)
                    {
                        ts.SetTower(selectedtower);
                        selectedSlot = ts;
                    }

                    selectedtower = null;
                }
                else
                {
                    TowerSlot ts = hit.transform.gameObject.GetComponent <TowerSlot>();
                    if (ts)
                    {
                        ts.activateUpgradePanel();
                        selectedSlot = ts;
                    }
                }
            }
        }
    }