示例#1
0
    public void Populate()
    {
        BaseTower tower = Control.GetComponent <UiContoller>().SelectedTower;

        if (tower == null)
        {
            return;
        }

        NameTag.GetComponent <Text>().text = tower.TowerName;

        List <TowerUpgrade> buyableUpgrades = tower.Tower.GetBuyableUpgrades();

        Upgrade0.GetComponent <Text>().text = buyableUpgrades.Exists(u => u.track == 0) ? createUpgradeLabel(buyableUpgrades.Find(u => u.track == 0)) : "Maxed!";
        Upgrade1.GetComponent <Text>().text = buyableUpgrades.Exists(u => u.track == 1) ? createUpgradeLabel(buyableUpgrades.Find(u => u.track == 1)) : "Maxed!";
        Upgrade2.GetComponent <Text>().text = buyableUpgrades.Exists(u => u.track == 2) ? createUpgradeLabel(buyableUpgrades.Find(u => u.track == 2)) : "Maxed!";

        TargetButton.GetComponent <TowerTargetButton>().SetText(tower.GetTargetingMode());
        SellButton.GetComponent <TowerSellButton>().SetText(tower.GetTowerWorth().ToString());
    }