// Show the information for this upgrade in the right info box, allowing it to be equipped and strengthened
        public void SelectUpgrade(UpgradeReference upgrade, bool showInfo)
        {
            // hide the selection outline of the previously selected upgrade
            if (_selectedUpgrade != null)
            {
                _upgradeTileDict[_selectedUpgrade].ShowSelectionOutline(false);
            }

            // set the passed upgrade to be selected
            _selectedUpgrade = upgrade;
            _upgradeTileDict[_selectedUpgrade].ShowSelectionOutline(true);

            // upgrade is unlocked
            if (_selectedUpgrade.Unlocked)
            {
                _upgradeInfoName.text        = _selectedUpgrade.UpgradeData.NameDisplay;
                _upgradeInfoDescription.text = _selectedUpgrade.UpgradeData.GetDescription(true);
                _buttonContainer.SetActive(true);                  // show the strengthen and equip buttons
                UpdateEquipButtons();
                UpdateStrengthenButton();
            }
            // upgrade is locked
            else
            {
                _buttonContainer.SetActive(false);
                _upgradeInfoName.text        = "Unknown";
                _upgradeInfoDescription.text = "This Essence has not been discovered.";
            }

            SoundManager.PlayClick1();
        }
        private UpgradeReference _selectedUpgrade;          // the upgrade currently selected (has it's information, equip, and strengthen buttons shown)

        // Reload the Upgrade tiles with the passed tower's Upgrades
        public void UpdatePanel(TowerInfo tower)
        {
            _uiBarManager.ShowBars(BarTop.Resources, BarBottom.TowerSelect);
            _loadedTower = tower;

            // reload upgrade information for each tile and display whether it is locked or unlocked
            _upgradeTileDict.Clear();
            UpgradeReference selectUpgradeOnLoad = null;
            var upgradeList = _loadedTower.Upgrades.Values.ToList();

            for (int i = 0; i < upgradeList.Count; i++)
            {
                _upgradeTiles[i].SetUpgradeTile(this, _loadedTower.Upgrades[upgradeList[i].UpgradeData]);
                _upgradeTiles[i].SetEquipped(upgradeList[i].Equipped, false);
                _upgradeTileDict.Add(upgradeList[i], _upgradeTiles[i]);

                // select the first unlocked upgrade to display it's information
                if (selectUpgradeOnLoad == null && upgradeList[i].Unlocked == true)
                {
                    selectUpgradeOnLoad = upgradeList[i];
                }
            }

            // no upgrade is unlocked
            if (selectUpgradeOnLoad == null)
            {
                if (_selectedUpgrade != null && _upgradeTileDict.Keys.Contains(_selectedUpgrade))
                {
                    selectUpgradeOnLoad = _selectedUpgrade;                             // select the previously selected tile (only works if the tower hasn't changed)
                }
                else
                {
                    selectUpgradeOnLoad = upgradeList[0];                               // otherwise select the first tile
                }
            }
            _selectedUpgrade = null;
            SelectUpgrade(selectUpgradeOnLoad, selectUpgradeOnLoad == null ? false : selectUpgradeOnLoad.Unlocked);
        }