public void IncrementAchievementOne()
 {
     PlayGamesScript.IncrementAchievement(GPGSIds.achievement_power_master, 1);
     scoreIncrementGo.SetActive(true);
     power.Play();
     StartCoroutine(DisableBonusOne(1f));
 }
 public void CollectKittyz(int amount = 1)
 {
     kittyzCollected += amount;
     ApplicationController.ac.playerData.updateKittys(1);
     PlayGamesScript.IncrementAchievement(Config.KITTYZ_RUSH_10, amount);
     PlayGamesScript.IncrementAchievement(Config.KITTYZ_RUSH_100, amount);
     PlayGamesScript.IncrementAchievement(Config.KITTYZ_RUSH_500, amount);
     PlayGamesScript.IncrementAchievement(Config.KITTYZ_RUSH_1000, amount);
 }
 public void IncrementAchievementTwo()
 {
     PlayGamesScript.IncrementAchievement(GPGSIds.achievement_perfect_master, 1);
     scoreIncrementGo2.SetActive(true);
     Time.timeScale      = 0.5f;
     Time.fixedDeltaTime = 0.02f * Time.timeScale;
     perfect.Play();
     xMark--;
     StartCoroutine(DisableBonusTwo(0.5f));
 }
    public void setScore(LevelEnum lvl, int score)
    {
        score = Mathf.Clamp(score, 0, 100);
        if (this.scores.ContainsKey(lvl))
        {
            if (this.scores[lvl] < score)
            {
                this.scores[lvl] = score;
            }
        }
        else
        {
            this.scores.Add(lvl, score);
        }

#if UNITY_ANDROID || UNITY_IOS
        // Achievements
        if (score >= 100 && PlayGamesPlatform.Instance.IsAuthenticated())
        {
            // get total number of fully completed levels
            int totalFullCompletedLvls = 0;
            foreach (KeyValuePair <LevelEnum, int> oneScore in scores)
            {
                if (oneScore.Value >= 100)
                {
                    totalFullCompletedLvls++;
                }
            }
            // compare it with the achievement current value and add the difference if necessary
            //int achvmtValue = PlayGamesScript.GetAchievementValue(Config.PERFECTIONIST_20);
            int achvmtValue = PlayGamesScript.perfectionnistCurrentValue;
            int diff        = totalFullCompletedLvls - achvmtValue;
            Debug.Log("PlayerData.setScore : totalFullCompletedLvls=" + totalFullCompletedLvls + " achvmtValue=" + achvmtValue + " diff=" + diff);
            if (achvmtValue >= 0 && diff > 0)
            {
                PlayGamesScript.UnlockAchievement(Config.PERFECTIONIST_1);
                PlayGamesScript.IncrementAchievement(Config.PERFECTIONIST_5, diff);
                PlayGamesScript.IncrementAchievement(Config.PERFECTIONIST_10, diff);
                PlayGamesScript.IncrementAchievement(Config.PERFECTIONIST_20, diff);
                PlayGamesScript.perfectionnistCurrentValue = totalFullCompletedLvls;
                Debug.Log("new perfectionnistCurrentValue=" + PlayGamesScript.perfectionnistCurrentValue);
            }
        }
#endif
    }
Exemple #5
0
    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.gameObject == theBall)
        {
            ballIsCaught = true;
            StartCoroutine(BallMoveToDog());
            theDog.GetComponent <Animator> ().SetTrigger("catchBall");
            GetComponent <AudioSource>().PlayOneShot(catchingSound);

            //Achievement
            if (triggerAchievement)
            {
                PlayGamesScript.UnlockAchievement(Config.BRING_BALL_1);
                PlayGamesScript.IncrementAchievement(Config.BRING_BALL_10, 1);
                PlayGamesScript.IncrementAchievement(Config.BRING_BALL_50, 1);
                PlayGamesScript.IncrementAchievement(Config.BRING_BALL_100, 1);
            }
        }
    }
    public void EndGame()
    {
        // Pause the game
        gameFinished   = true;
        gamePaused     = true;
        Time.timeScale = 0f;
        pc.StartMoving(0f);
        int score = Mathf.FloorToInt(CalculateScore());

        ApplicationController.ac.FinishLevel(this.level.id, score);

        // Achievements
        if (lifeLost == 0)
        {
            PlayGamesScript.IncrementAchievement(Config.INTOUCHABLE_5, 1);
            PlayGamesScript.IncrementAchievement(Config.INTOUCHABLE_25, 1);
            PlayGamesScript.IncrementAchievement(Config.INTOUCHABLE_50, 1);
            PlayGamesScript.IncrementAchievement(Config.INTOUCHABLE_100, 1);
        }
        if (this.level.difficulty == DifficultyEnum.NIGHTMAR)
        {
            PlayGamesScript.UnlockAchievement(Config.NIGHTMARE);
            if (score >= 100)
            {
                PlayGamesScript.UnlockAchievement(Config.NIGHTMARE_PERFECT);
            }
        }


        // Analytics
        AnalyticsResult ar = Analytics.CustomEvent("LevelFinished_" + this.level.name, new Dictionary <string, object> {
            { "date", System.DateTime.Now.ToString() },
            { "score", score },
            { "life_lost", lifeLost },
            { "kittys_collected", kittyzCollected },
            { "time", levelTimer }
        });

        Debug.Log("Analytics LevelFinished :" + ar);
    }
    public void GameOver()
    {
        guic.GameOver();

        // Achievements
        PlayGamesScript.IncrementAchievement(Config.GAME_OVER, 1);
        if (this.level.difficulty == DifficultyEnum.NIGHTMAR)
        {
            PlayGamesScript.IncrementAchievement(Config.NIGHTMARE_DEATH, 1);
        }

        // Analytics
        AnalyticsResult ar = Analytics.CustomEvent("GameOver_" + this.level.name, new Dictionary <string, object> {
            { "date", System.DateTime.Now.ToString() },
            { "position", pc.transform.position },
            { "life_lost", lifeLost },
            { "kittys_collected", kittyzCollected },
            { "time", levelTimer }
        });

        Debug.Log("Analytics GameOver :" + ar);
    }
Exemple #8
0
 public void Increment()
 {
     PlayGamesScript.IncrementAchievement(GPGSIds.achievement_touch_screen, 5);
 }
Exemple #9
0
 public void Increment()
 {
     PlayGamesScript.IncrementAchievement(GPGSIds.achievement_incremental_achievement, 5);
 }
Exemple #10
0
 public void Increment()
 {
     PlayGamesScript.IncrementAchievement(GPGSIds.achievement_icarus_lives, 100);
 }
 public void IncrementBy14999()
 {
     PlayGamesScript.IncrementAchievement(PGPS.achievement_collect_100_paw, 14999);
     PlayGamesScript.IncrementAchievement(PGPS.achievement_thousandaire, 14999);
     PlayGamesScript.IncrementAchievement(PGPS.achievement_tenthousandaire, 14999);
 }
 public void IncrementBySixty()
 {
     PlayGamesScript.IncrementAchievement(PGPS.achievement_collect_100_paw, 60);
     PlayGamesScript.IncrementAchievement(PGPS.achievement_thousandaire, 60);
     PlayGamesScript.IncrementAchievement(PGPS.achievement_tenthousandaire, 60);
 }
 public void IncrementByThree()
 {
     PlayGamesScript.IncrementAchievement(PGPS.achievement_collect_100_paw, 3);
     PlayGamesScript.IncrementAchievement(PGPS.achievement_thousandaire, 3);
     PlayGamesScript.IncrementAchievement(PGPS.achievement_tenthousandaire, 3);
 }