Пример #1
0
    private void UpdateCollectedCoinsIcons(int level)
    {
        int coins = GamePrefController.LoadCoinsForLevel(level + 1);

        coin1.color = coins > 0 ? Color.yellow : Color.grey;
        coin2.color = coins > 1 ? Color.yellow : Color.grey;
        coin3.color = coins > 2 ? Color.yellow : Color.grey;
    }
    public void ShowLevelFinishedPanel()
    {
        Time.timeScale = 0;
        bestCoins      = GamePrefController.LoadCoinsForLevel(SceneManager.GetActiveScene().buildIndex);
        currentCoins   = gameManager.Coins;

        currentCoin1.color = currentCoins > 0 ? Color.yellow : Color.grey;
        currentCoin2.color = currentCoins > 1 ? Color.yellow : Color.grey;
        currentCoin3.color = currentCoins > 2 ? Color.yellow : Color.grey;

        bestCoin1.color = bestCoins > 0 ? Color.yellow : Color.grey;
        bestCoin2.color = bestCoins > 1 ? Color.yellow : Color.grey;
        bestCoin3.color = bestCoins > 2 ? Color.yellow : Color.grey;

        if (currentCoins > bestCoins)
        {
            GamePrefController.SaveCoinsForLevel(SceneManager.GetActiveScene().buildIndex, currentCoins);
        }

        gameEndLevelPanel.SetActive(true);
    }