void OnTriggerEnter2D(Collider2D other)
    {
        if (other.CompareTag("Block") || other.CompareTag("SpecialBlock"))
        {
            if (GameControl.control.highScore < UpdateScore.updateScore)
            {
                GameControl.control.highScore = UpdateScore.updateScore;
                GooglePlay.AddScoreToLeaderboard(GPGSIds.leaderboard_high_score, (long)UpdateScore.updateScore);

                if (GameControl.control.highScore >= 1000)
                {
                    GooglePlay.UnlockAchievement(GPGSIds.achievement_ultimate_prime_defender);
                }
            }
            GooglePlay.IncrementalAchievement(GPGSIds.achievement_prime_novice, 1);
            GooglePlay.IncrementalAchievement(GPGSIds.achievement_prime_intermediate, 1);
            GooglePlay.IncrementalAchievement(GPGSIds.achievement_prime_expert, 1);
            SceneManager.LoadScene("Main");
        }

        if (other.CompareTag("SPChild"))
        {
            Destroy(other.gameObject);
        }
    }
 public void RestartThisGame()
 {
     //UpdateScore updateScore = (UpdateScore)FindObjectOfType(typeof(UpdateScore));
     if (GameControl.control.highScore < UpdateScore.updateScore)
     {
         GameControl.control.highScore = UpdateScore.updateScore;
         GooglePlay.AddScoreToLeaderboard(GPGSIds.leaderboard_high_score, UpdateScore.updateScore);
     }
     Time.timeScale = 1;
     MenuSound.menuSound.activateClickButtonSound = true;
     SceneManager.LoadScene("Main");
 }
Example #3
0
    public void SaveCurrentLevelWin(int Stars)
    {
        string currentScene;
        int    currentSceneNo;

        currentScene = SceneManager.GetActiveScene().name;

        currentSceneNo = Convert.ToInt32(currentScene.Substring(currentScene.IndexOf("_") + 1, currentScene.Length - Convert.ToInt32(currentScene.IndexOf("_") + 1)));

        if (currentSceneNo == PlayerPrefs.GetInt("UnlockedScenes"))
        {
            PlayerPrefs.SetInt("UnlockedScenes", PlayerPrefs.GetInt("UnlockedScenes") + 1);
            GooglePlay.IncrementAchievement(GPGSIds.leaderboard_high_scores, 10);
            GooglePlayManager.Instance.View5WinsIncrementalAchievment();
            GooglePlayManager.Instance.View10WinsIncrementalAchievment();
            GooglePlayManager.Instance.View15WinsIncrementalAchievment();
            GooglePlayManager.Instance.View20WinsIncrementalAchievment();

            PlayerPrefs.SetInt("WinsInARow", PlayerPrefs.GetInt("WinsInARow") + 1);

            GooglePlayManager.Instance.ViewWins3LevelsInARowIncrementalAchievment();
            GooglePlayManager.Instance.ViewWins5LevelsInARowIncrementalAchievment();
        }


        if (PlayerPrefs.HasKey("Stars_" + currentSceneNo.ToString()))
        {
            if (PlayerPrefs.GetInt("Stars_" + currentSceneNo.ToString()) < Stars)
            {
                PlayerPrefs.SetInt("TotalStars", PlayerPrefs.GetInt("TotalStars") + Stars - PlayerPrefs.GetInt("Stars_" + currentSceneNo.ToString()));
                PlayerPrefs.SetInt("Stars_" + currentSceneNo.ToString(), Stars);
            }
        }
        else
        {
            PlayerPrefs.SetInt("Stars_" + currentSceneNo.ToString(), Stars);
            PlayerPrefs.SetInt("TotalStars", PlayerPrefs.GetInt("TotalStars") + Stars);
        }

        GooglePlay.AddScoreToLeaderboard(GPGSIds.leaderboard_high_scores, PlayerPrefs.GetInt("TotalStars") * 10);
    }
 public void Death()
 {
     UiCanvas.instance.Death(true);
     GooglePlay.AddScoreToLeaderboard(EBGPSIds.leaderboard_elemental_ballz, level);
 }