Beispiel #1
0
    public void printValues()
    {
        GemsText.text     = gemsAmount.ToString() + "\n" + gemsString.text;
        GemsText.maxChars = GemsText.text.Length;
        GemsText.Commit();

        CoinsText.text     = coinsAmount.ToString() + "\n" + coinsString.text;
        CoinsText.maxChars = CoinsText.text.Length;
        CoinsText.Commit();

        if (gemsAmount < 10)
        {
            GemsIcon.spriteId  = GemsIcon.GetSpriteIdByName("gems");
            CoinsIcon.spriteId = CoinsIcon.GetSpriteIdByName("gold1");
        }
        else if (gemsAmount < 40)
        {
            GemsIcon.spriteId  = GemsIcon.GetSpriteIdByName("gem2");
            CoinsIcon.spriteId = CoinsIcon.GetSpriteIdByName("gold2");
        }
        else if (gemsAmount < 100)
        {
            GemsIcon.spriteId  = GemsIcon.GetSpriteIdByName("gem4");
            CoinsIcon.spriteId = CoinsIcon.GetSpriteIdByName("gold3");
        }
        else
        {
            GemsIcon.spriteId  = GemsIcon.GetSpriteIdByName("gem6");
            CoinsIcon.spriteId = CoinsIcon.GetSpriteIdByName("gold4");
        }
    }
 public void showCoins()
 {
     CoinsText.GetComponent <Text>().text = "Coins: " + this.GetComponent <PlayersScoreCounter>().getCoins().ToString();
 }