示例#1
0
    public void CollectCoin()
    {
        //The coin has notified us that we've collected a coin
        coinsRemaining--;
        uiController.coinCounter.SetValue(coinsRemaining);
        audioController.CollectCoin();
        uiController.flash.Show(coinFlashColor, flashTime);

        if (coinsRemaining == 0)
        {//no coins remaining, we've won the game
            EndGame(true);
        }

        int totalCoins = PlayerPrefs.GetInt(KEY_TOTAL_COINS, 0);

        totalCoins++;
        PlayerPrefs.SetInt(KEY_TOTAL_COINS, totalCoins);

        Debug.Log("Total Coins Collected" + totalCoins);
    }