示例#1
0
    public void removeGold(int removed)
    {
        TextFadeOut LooseGoldText = GameObject.Find("LooseGoldText").GetComponent <TextFadeOut>();


        if (!PlayerPrefs.HasKey("Gold"))
        {
            PlayerPrefs.SetInt("Gold", 0);
        }
        gold  = PlayerPrefs.GetInt("Gold");
        gold -= removed;
        //Sauvegarde l'info
        PlayerPrefs.SetInt("Gold", gold);
        goldText.text = "Gold: " + gold;

        LooseGoldText.GetComponent <Text>().text = "Gold +" + removed;
        LooseGoldText.FadeOut();
    }
示例#2
0
    public void addGold(int added)
    {
        TextFadeOut WingGoldText = GameObject.Find("WinGoldText").GetComponent <TextFadeOut>();

        //Rajoute un gold
        if (!PlayerPrefs.HasKey("Gold"))
        {
            PlayerPrefs.SetInt("Gold", 0);
        }
        gold  = PlayerPrefs.GetInt("Gold");
        gold += added;
        //Sauvegarde l'info
        PlayerPrefs.SetInt("Gold", gold);
        goldText.text = "Gold: " + gold;

        WingGoldText.GetComponent <Text>().text = "Gold +" + added;
        WingGoldText.FadeOut();
    }