예제 #1
0
 private void UpdateTexts()
 {
     if (data != null)                                                                                                                         //if data is null, first texts already set (money should be 0 and cant buy anyway)
     {
         healText.text        = $"increases heal from {50+10*data.powerupLevels[0]} to {10+ 50 + 10 * data.powerupLevels[0]}";                 // heal: 50+10*lvl
         shieldText.text      = $"increases shield duration from {6+data.powerupLevels[1]} seconds to {1+ 6 + data.powerupLevels[1]} seconds"; // shield duration: 6+lvl
         atkBoostText.text    = $"increases attack boost from {5 + 5 * data.powerupLevels[2]} to {5 + 5 + 5 * data.powerupLevels[2]}";         // attack boost: 5+5*lvl
         healTextBtn.text     = 100 + 50 * data.powerupLevels[0] + "$";                                                                        //  the cost is 100+50*lvl
         shieldTextBtn.text   = 100 + 50 * data.powerupLevels[1] + "$";                                                                        // the cost is 100+50*lvl
         atkBoostTextBtn.text = 100 + 50 * data.powerupLevels[2] + "$";                                                                        //  the cost is 100+50*lvl
         shopScript.UpdateMoneyText(Player.money);
     }
 }
예제 #2
0
    private void UpdateTexts()
    {
        if (data != null) //if data is null, first texts already set (money should be 0 and cant buy anyway)
        {
            healthText.text   = data.health + "/" + data.health;
            playerInfo.text   = "health: " + data.health + "\n" + "attack: " + data.attack + "\n" + "missile damage: " + data.MissileDamage;
            missileCount.text = "x " + data.startMissiles;

            healthTextBtn.text       = 100 + 50 * ((data.health - 100) / 20) + "$";       // calc current hp level and the cost is 100+50*lvl
            attackTextBtn.text       = 100 + 50 * ((data.attack - 10) / 5) + "$";         // calc current attack level and the cost is 100+50*lvl
            missileDmgTextBtn.text   = 100 + 50 * ((data.MissileDamage - 20) / 10) + "$"; // calc current missile damage level and the cost is 100+50*lvl
            missileCountTextBtn.text = 100 + 50 * (data.startMissiles) + "$";             // cost is 100+50*lvl
            shopScript.UpdateMoneyText(Player.money);
        }
    }