Ejemplo n.º 1
0
    public void onSelect(int value)
    {
        Color  c     = buttons[value].GetComponent <Image>().color;
        string guess = "#" + ColorUtility.ToHtmlStringRGB(c);

        if (guess.Equals(q.clue))
        {
            points++;
            points_disp.GetComponent <Text>().text = points.ToString();
            if (points >= 10)
            {
                authentication.UnlockAchievement(GPGSIds.achievement_hexcelence);
            }
            if (points >= 10 && lives == 10)
            {
                authentication.UnlockAchievement(GPGSIds.achievement_ten_and_0);
            }
            if (points >= 20)
            {
                authentication.UnlockAchievement(GPGSIds.achievement_hexpert);
            }
            if (points >= 20 && lives == 10)
            {
                authentication.UnlockAchievement(GPGSIds.achievement_20_and_0);
            }
            if (points >= 50)
            {
                authentication.UnlockAchievement(GPGSIds.achievement_color_king);
            }

            setLevel();
        }
        else
        {
            lives--;
            lives_disp.GetComponent <Text>().text = lives.ToString();
            if (lives == 1 && !PlayerPrefs.HasKey("ads"))
            {
                adMobAds.LoadInterstitial();
                unityAds.LoadInterstitial();
            }
            if (lives <= 0)
            {
                if (PlayerPrefs.GetInt("hs") < points)
                {
                    PlayerPrefs.SetInt("hs", points);
                }
                authentication.AddScoreToLeader(GPGSIds.leaderboard_world_rankings, points);
                resetGame();
            }
        }
    }