private bool canUpgradeTower()
    {
        if (selectedGO != null)
        {
            TowerData  towerData = selectedGO.GetComponent <TowerData> ();
            TowerLevel nextLevel = towerData.GetNextLevel();

            if (nextLevel != null)
            {
                return(gameManager.Gold >= nextLevel.cost);
            }
        }
        return(false);
    }
예제 #2
0
    private bool CanUpgrade()
    {
        if (tower == null)
        {
            return(false);
        }

        TowerData data = tower.GetComponent <TowerData>();

        TowerLevel next = data.GetNextLevel();

        if (next == null)
        {
            return(false);
        }

        return(true);
    }
    void TowerInfoList()
    {
        string     towerName = selectedGO.gameObject.name;
        TowerData  towerData = selectedGO.GetComponent <TowerData> ();
        TowerLevel nextLevel = towerData.GetNextLevel();

        switch (towerName)
        {
        case "ArtemisTower(Clone)":
            textInfo.GetComponent <Text>().text = selectedGO.gameObject.GetComponent <TowerData>().CurrentLevel.visualization.gameObject.name
                                                  + "\nDamage: " + selectedGO.GetComponent <TowerData>().damageDeal + "\nAttack Speed: " + selectedGO.GetComponent <TowerData>().attackSpeed *100
                                                  + "\nUpgrade Cost: " + nextLevel.cost;
            break;

        case "ZuesTower(Clone)":
            textInfo.GetComponent <Text>().text = selectedGO.gameObject.GetComponent <TowerData>().CurrentLevel.visualization.gameObject.name
                                                  + "\nDamage: " + selectedGO.GetComponent <TowerData>().damageDeal + "\nAttack Speed: " + selectedGO.GetComponent <TowerData>().attackSpeed *100
                                                  + "\nUpgrade Cost: " + nextLevel.cost;
            break;

        case "ChioneTower(Clone)":
            textInfo.GetComponent <Text>().text = selectedGO.gameObject.GetComponent <TowerData>().CurrentLevel.visualization.gameObject.name
                                                  + "\nDamage: " + selectedGO.GetComponent <TowerData>().damageDeal + "\nAttack Speed: " + selectedGO.GetComponent <TowerData>().attackSpeed *100
                                                  + "\nSPD Reduce: " + selectedGO.GetComponent <TowerData>().slowSpeed *100 + "%\nBurn: " + selectedGO.GetComponent <TowerData>().burnDamage
                                                  + "\nUpgrade Cost: " + nextLevel.cost;
            break;

        case "HeliosTower(Clone)":
            textInfo.GetComponent <Text>().text = selectedGO.gameObject.GetComponent <TowerData>().CurrentLevel.visualization.gameObject.name
                                                  + "\nDamage: " + selectedGO.GetComponent <TowerData>().damageDeal + "\nAttack Speed: " + selectedGO.GetComponent <TowerData>().attackSpeed *100
                                                  + "\nBurn: " + selectedGO.GetComponent <TowerData>().burnDamage + "/Second"
                                                  + "\nUpgrade Cost: " + nextLevel.cost;
            break;

        case "PlutusTower(Clone)":
            textInfo.GetComponent <Text>().text = selectedGO.gameObject.GetComponent <TowerData>().CurrentLevel.visualization.gameObject.name
                                                  + "\nCoin Rate: " + selectedGO.gameObject.GetComponent <TowerData>().coinRate;
            break;
        }
    }