public void OnBallBuy() { if (SaveManager.Instance.DoesOwnBall(selectedBallIndex)) { SetBall(selectedBallIndex); } else { if (SaveManager.Instance.BuyBall(selectedBallIndex, ballCosts[selectedBallIndex])) { //succes he bough the ball PlayServices.UnlockAchievement(GPGSIds.achievement_first_purchase); PlayServices.IncrementAchievement(GPGSIds.achievement_5_balls_purchased, 1); SetBall(selectedBallIndex); UpdateText(); } else { //he dont have enough diamonds to buy it :C NotEnoughDiamondsText.text = "You need " + (ballCosts[selectedBallIndex] - SaveManager.Instance.data.diamonds); notEnoughMoneyTab.SetActive(true); } } OnNewPage(); }
public void CheckInkrementalAhivements() { ScoreContainer scoreConatiner = scoreController.scoreContainer; playServices.IncrementAchievement(GPGSIds.achievement_incremental_achievement_1, (int)(scoreConatiner.BumperScore)); playServices.IncrementAchievement(GPGSIds.achievement_incremental_achievement_2, (int)(scoreConatiner.SingshotScore)); playServices.IncrementAchievement(GPGSIds.achievement_incremental_achievement_3, (int)(scoreConatiner.TriggerScore)); playServices.IncrementAchievement(GPGSIds.achievement_incremental_achievement_4, (int)(scoreConatiner.TeleportScore)); playServices.IncrementAchievement(GPGSIds.achievement_incremental_achievement_5, (int)(scoreConatiner.BlackHolerScore)); if (scoreController.levelController.score >= 5000) { playServices.UnlockAchievement(GPGSIds.achievement_achievement_3); } if (scoreController.levelController.score >= 50000) { playServices.UnlockAchievement(GPGSIds.achievement_achievement_4); } }
public void AddScoreToLeaderBoard(LevelType type) { if (type == LevelType.NormalLevels) { print("Adding snow score to leaderboard"); PlayServices.IncrementAchievement(GPGSIds.achievement_completed_10_normal_levels, 1); PlayServices.IncrementAchievement(GPGSIds.achievement_completed_all_normal_levels, 1); } else if (type == LevelType.SnowLevels) { print("Adding snow score to leaderboard"); PlayServices.IncrementAchievement(GPGSIds.achievement_completed_10_snow_levels, 1); PlayServices.IncrementAchievement(GPGSIds.achievement_completed_all_snow_levels, 1); } else if (type == LevelType.BlackAndWhite) { //TODO(Klendi): BW levels implement } }
public void OnGameSucces() { cameraController.Play(.2f, false); AudioManager.instance.PlaySound("SuccesSound"); StartCoroutine(WaitThenUnplay(2.2f, .2f)); gameOver = true; succesTab.SetActive(true); uiTab.SetActive(false); highScoreDiamonds.text = string.Format("{0} / {1}", diamonds, totalDiamonds); highScoreSpecialDiamonds.text = string.Format("{0} / {1}", specialDiamonds, totalSpecialDiamonds); SaveManager.Instance.data.diamonds += diamonds; SaveManager.Instance.data.specialDiamond += specialDiamonds; AdsManager.Instance.canShowAd = true; if (isEndlessLevel) { EndlessManager endless = FindObjectOfType <EndlessManager>(); PlayGamesPlatform.Instance.LoadScores( GPGSIds.leaderboard_blitexs_endless, LeaderboardStart.PlayerCentered, 1, LeaderboardCollection.Public, LeaderboardTimeSpan.AllTime, (LeaderboardScoreData data) => { if (data.Valid) { long total = data.PlayerScore.value + (long)endless.score; PlayServices.AddScoreToLeaderBoard(GPGSIds.leaderboard_blitexs_endless, total); } }); } if (SaveManager.Instance.data.completedLevels == 0) { //first level that is played PlayServices.UnlockAchievement(GPGSIds.achievement_first_level); } if (!isSnowLevel) { SaveManager.Instance.CompleteLevel(Manager.Instance.sceneIndex, false); if (SaveManager.Instance.data.completedLevels >= 15 && !SaveManager.Instance.data.hasUnlockedSnowTheme) { //player has completed 15 levels so now he unlocks snow theme print("Congrats u unlocked snow theme"); PlayServices.UnlockAchievement(GPGSIds.achievement_unlocked_snow_theme); unlockedSnowTheme.SetActive(true); SaveManager.Instance.data.hasUnlockedSnowTheme = true; SaveManager.Instance.Save(); } } else if (isSnowLevel) { print("It is a snow level and now calling complete level"); SaveManager.Instance.CompleteLevel(Manager.Instance.sceneIndex, true); } PlayGamesPlatform.Instance.LoadScores( GPGSIds.leaderboard_blitexs_diamonds, LeaderboardStart.PlayerCentered, 1, LeaderboardCollection.Public, LeaderboardTimeSpan.AllTime, (LeaderboardScoreData data) => { if (data.Valid) { long total = data.PlayerScore.value + (long)diamonds; PlayServices.AddScoreToLeaderBoard(GPGSIds.leaderboard_blitexs_diamonds, total); } }); PlayServices.IncrementAchievement(GPGSIds.achievement_100_diamonds, diamonds); PlayServices.IncrementAchievement(GPGSIds.achievement_1000_diamonds, diamonds); PlayServices.IncrementAchievement(GPGSIds.achievement_10_000_diamonds, diamonds); StartCoroutine(WaitThenDestroy(1.5f)); }