Пример #1
0
    public Dictionary <int, int> ranking = new Dictionary <int, int>(); //score, Player

    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else
        {
            Destroy(this);
        }
        //DontDestroyOnLoad(gameObject);
    }
    public void CompleteTutorial(DataType.Minigame gameName)
    {
        // Copy current struct to a new one
        MinigameStats newStats = gameStats[gameName];

        // Modify desired variable
        newStats.isTutorialPending = false;

        // Save changes to new struct
        gameStats[gameName] = newStats;

        // Save changes to save data
        SaveGame();
    }
    // Called at the end of a minigame
    public void LevelUp(DataType.Minigame gameName)
    {
        MinigameStats newStats = gameStats[gameName]; // Copy current struct to a new one

        numOfGamesCompleted++;

        if (newStats.stars < 3)
        {
            newStats.stars += 1;
        }
        if (newStats.level < 3)
        {
            newStats.level += 1;
        }

        if (newStats.stars == 1 || newStats.stars == 3)
        {
            if (ReviewManager.Instance)
            {
                ReviewManager.Instance.AddReviewGameToList(gameName);
            }

            // Set needReview to true when lvl 3 is completed every other time, temporary measure to reduce annoying reviews
            if (newStats.stars >= 3)
            {
                if (activateReview)
                {
                    if (ReviewManager.Instance)
                    {
                        ReviewManager.Instance.NeedReview = true;
                    }
                }
                activateReview = !activateReview;
            }
            else
            {
                if (ReviewManager.Instance)
                {
                    ReviewManager.Instance.NeedReview = true;
                }
            }
        }
        gameStats[gameName] = newStats; // Save changes to new struct

        // Save changes to save data
        SaveGame();
    }