// Update is called once per frame void Update() { number = Jumper.position.y; scoreText2D.text = number.ToString("0"); if (number > 200) { PlayGamesScript.UnlockAchievement(PGPS.achievement_get_a_high_score_of_200_in_coins_mode); } if (number > 500) { PlayGamesScript.UnlockAchievement(PGPS.achievement_500_in_coins_mode); } if (number > 1000) { PlayGamesScript.UnlockAchievement(PGPS.achievement_1000_in_coins_mode); } if (number > PlayerPrefs.GetFloat("HighScore", 0)) { PlayGamesScript.AddScoreToLeaderboard(PGPS.leaderboard_jumping_leaderboard, (long)number); PlayerPrefs.SetFloat("HighScore", number); highScore.text = number.ToString("0"); PlayGamesScript.instance.SaveData(); } }
/// <summary> /// A method to handle checking for "Finish All Levels with 3 Stars" Achievement /// </summary> private void CheckThreeStarAchievement() { if (GameData.Instance.saveData.ThreeStarLevels >= 60) { PlayGamesScript.UnlockAchievement("CgkIscHpwIUZEAIQEQ"); } }
public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args) { // A consumable product has been purchased by this user. if (String.Equals(args.purchasedProduct.definition.id, kProductIDConsumable, StringComparison.Ordinal)) { Debug.Log(string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id)); // The consumable item has been successfully purchased, add 100 coins to the player's in-game score. //ScoreManager.score += 100; ApplicationController.ac.playerData.updateKittys(500, kittyzText, true); // Achievement PlayGamesScript.UnlockAchievement(Config.ANIMAL_CAUSE); } // Or ... a non-consumable product has been purchased by this user. /* else if (String.Equals (args.purchasedProduct.definition.id, kProductIDNonConsumable, StringComparison.Ordinal)) { * Debug.Log (string.Format ("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id)); * // TODO: The non-consumable item has been successfully purchased, grant this item to the player. * } * // Or ... a subscription product has been purchased by this user. * else if (String.Equals (args.purchasedProduct.definition.id, kProductIDSubscription, StringComparison.Ordinal)) { * Debug.Log (string.Format ("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id)); * // TODO: The subscription item has been successfully purchased, grant this to the player. * }*/ // Or ... an unknown product has been purchased by this user. Fill in additional products here.... else { Debug.Log(string.Format("ProcessPurchase: FAIL. Unrecognized product: '{0}'", args.purchasedProduct.definition.id)); } // Return a flag indicating whether this product has completely been received, or if the application needs // to be reminded of this purchase at next app launch. Use PurchaseProcessingResult.Pending when still // saving purchased products to the cloud, and when that save is delayed. return(PurchaseProcessingResult.Complete); }
IEnumerator DestroyRope() { SpriteRenderer[] sprites = rope.GetComponentsInChildren <SpriteRenderer> (); Color newColor; for (float t = 0.0f; t <= 1.0f; t += Time.deltaTime / 1f) { foreach (SpriteRenderer sprite in sprites) { newColor = sprite.color; newColor.a = Mathf.Lerp(1, 0, t); sprite.color = newColor; } yield return(null); } Destroy(rope.gameObject); yield return(new WaitForSeconds(1f)); guic.DisplayDialog(DialogEnum.rat_thanks_cat); yield return(new WaitForSeconds(.5f)); RatFlip(); rat.GetComponent <Rigidbody2D> ().isKinematic = true; ratLiberated = true; // Achievement "free Croc" PlayGamesScript.UnlockAchievement(Config.IM_FREE); }
public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args) { // A consumable product has been purchased by this user. if (String.Equals(args.purchasedProduct.definition.id, PRODUCT_9999_PAW, StringComparison.Ordinal)) { // The consumable item has been successfully purchased, add 100 coins to the player's in-game score. CoinsManager.Coins += 14999; CoinsManager.instance.IncrementBy14999(); PlayGamesScript.UnlockAchievement(PGPS.achievement_bling_bling); } // Or ... a non-consumable product has been purchased by this user. else if (String.Equals(args.purchasedProduct.definition.id, PRODUCT_14999_PAW, StringComparison.Ordinal)) { CoinsManager.Coins += 19999; CoinsManager.instance.IncrementBy19999(); PlayGamesScript.UnlockAchievement(PGPS.achievement_bling_bling_vol_2); } // Or ... a subscription product has been purchased by this user. else if (String.Equals(args.purchasedProduct.definition.id, PRODUCT_NO_ADS, StringComparison.Ordinal)) { Debug.Log("No ads"); } // Or ... an unknown product has been purchased by this user. Fill in additional products here.... else { Debug.Log(string.Format("ProcessPurchase: FAIL. Unrecognized product: '{0}'", args.purchasedProduct.definition.id)); } // Return a flag indicating whether this product has completely been received, or if the application needs // to be reminded of this purchase at next app launch. Use PurchaseProcessingResult.Pending when still // saving purchased products to the cloud, and when that save is delayed. return(PurchaseProcessingResult.Complete); }
public void OpenScene(int index) { if (index == 1) { PlayGamesScript.UnlockAchievement(GPGSIds.achievement_welcome); } SceneManager.LoadScene(index); }
private void OnTriggerEnter() { PlayGamesScript.UnlockAchievement(PGPS.achievement_complete_level_9); CoinsManager.Coins += 60; CoinsManager.instance.IncrementBySixty(); PlayerPrefs.SetInt("coins", CoinsManager.Coins); PlayerPrefs.Save(); }
private void OnTriggerEnter() { PlayGamesScript.UnlockAchievement(PGPS.achievement_complete_level_1); CoinsManager.Coins += 5; CoinsManager.instance.IncrementByFive(); Debug.Log("+5 coins"); PlayerPrefs.SetInt("coins", CoinsManager.Coins); PlayerPrefs.Save(); }
public void Win() { pauseButton.interactable = false; soundEffector.PlayWinSound(); Time.timeScale = 0f; player.enabled = false; winScreen.SetActive(true); if (!PlayerPrefs.HasKey(Level) || PlayerPrefs.GetInt(Level) < levelNumber) { if (levelNumber == 1) { PlayGamesScript.UnlockAchievement(GPGSIds.achievement_first_step); } if (levelNumber == 10) { PlayGamesScript.UnlockAchievement(GPGSIds.achievement_runner); } PlayerPrefs.SetInt(Level, SceneManager.GetActiveScene().buildIndex); } if (GetComponent <Inventory>().AreAllGemsCollected()) { bonusPanel.SetActive(true); bonusReward = 500; PlayGamesScript.UnlockAchievement(GPGSIds.achievement_collector); } if (PlayerPrefs.HasKey(Coins)) { PlayerPrefs.SetInt(Coins, PlayerPrefs.GetInt(Coins) + player.GetCoins() + bonusReward); } else { PlayerPrefs.SetInt(Coins, player.GetCoins() + bonusReward); } GetComponent <Inventory>().RecountItems(); if (AchievementHelper.AreAllGemsCollected()) { PlayGamesScript.UnlockAchievement(GPGSIds.achievement_explorer); } if (PlayerPrefs.HasKey(Constants.Timer + levelNumber)) { var bestTime = PlayerPrefs.GetFloat(Constants.Timer + levelNumber); if (bestTime > timer) { SetRecordAndCheckAchievements(); } } else { SetRecordAndCheckAchievements(); } }
public void Die() { animator.SetInteger("life", 0); animator.SetFloat("x.velocity", 0); stunAnimation.SetActive(true); this.gameObject.layer = LayerMask.NameToLayer("Transparent"); audioSource.Stop(); audioSource.PlayOneShot(dyingSound); OnDeath.Invoke(); // Achievement PlayGamesScript.UnlockAchievement(Config.DEFEAT_BULLDOG); }
void Update() { // If Android back button is pressed, go back or exit //if (Input.GetKeyDown(KeyCode.Escape)) // Application.Quit(); // Track the "Nosy" achievement on the help panel if (trackHelpAchievement && helpScrollRect.normalizedPosition.y < 0.1f) { PlayGamesScript.UnlockAchievement(Config.NOSY); trackHelpAchievement = false; } }
private void OnCollisionEnter(Collision collision) { if (collision.collider.tag == "Player" && !SoundIsPlaying1) { SoundIsPlaying1 = true; FindObjectOfType <AudioManager>().Play("AeraNaepi"); thisVersion.SetActive(false); otherVersion.SetActive(true); Destroy(gameObject); FindObjectOfType <GameManager>().EndGame(); PlayGamesScript.UnlockAchievement(PGPS.achievement_easter_egg_alert); } }
public void EndGame() { if (gameHasEnded == false) { gameHasEnded = true; if (Coin.TaaraSigns > 49) { Debug.Log("TAARAEKSPERT"); PlayGamesScript.UnlockAchievement(PGPS.achievement_taaraekspert); } Debug.Log("GAME OVER"); Invoke("Restart", restartDelay); } }
private IEnumerator gameOverActivated() { gameOver = true; endScore.text = "Score: " + score; yield return(new WaitForSeconds(0.01f)); dead.gameObject.SetActive(true); yield return(new WaitForSeconds(2f)); dead.gameObject.SetActive(false); Destroy(dead.gameObject); removeGameText(); if (score > 100) { PlayGamesScript.UnlockAchievement(GPGSIds.achievement_100_points); } if (score > 200) { PlayGamesScript.UnlockAchievement(GPGSIds.achievement_200_points); } if (score > highScore) { highScore = score; endHighScore.text = "High Score: " + highScore; newBest.gameObject.SetActive(true); } else { highScore = score; newBest.gameObject.SetActive(false); } PlayGamesScript.AddScoreToLeaderboard(GPGSIds.leaderboard_leaderboard, score); foreach (Button button in buttons) { button.gameObject.SetActive(true); } panel.gameObject.SetActive(true); endScore.gameObject.SetActive(true); endHighScore.gameObject.SetActive(true); }
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 }
private void SetRecordAndCheckAchievements() { PlayerPrefs.SetFloat(Constants.Timer + levelNumber, timer); PlayGamesScript.AddScoreToLeaderboard(levelLeaderboards[levelNumber], (long)(timer * 1000)); if (AchievementHelper.IsGoldenMedal(timer, levelNumber)) { PlayGamesScript.UnlockAchievement(GPGSIds.achievement_champion); } if (AchievementHelper.AreAllGoldenMedals()) { PlayGamesScript.UnlockAchievement(GPGSIds.achievement_speed_runner); } long score = AchievementHelper.RecountScore(); PlayGamesScript.AddScoreToLeaderboard(GPGSIds.leaderboard_overall, score); newRecordPanel.SetActive(true); }
public void BuyBeigeSkin(int cost) { if (hasBeige || PlayerPrefs.GetInt(Coins) >= cost) { activeSkinButton.interactable = true; skinButtons[4].interactable = false; activeSkinButton = skinButtons[4]; activeSkinButton.transform.GetChild(0).gameObject.SetActive(false); PlayerPrefs.SetInt(HasSkinBeige, 1); PlayerPrefs.SetString(SkinActive, SkinColorBeige); if (!hasBeige) { PlayGamesScript.UnlockAchievement(GPGSIds.achievement_new_look); PlayerPrefs.SetInt(Coins, PlayerPrefs.GetInt(Coins) - cost); hasBeige = true; } } }
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); } } }
void Update() { if (StarGame == true) { Time.timeScale = 1; StartGameText.SetActive(false); UFO.SetActive(false); } else { Time.timeScale = 0; Screen.sleepTimeout = SleepTimeout.NeverSleep; } if (score == 10) { PlayGamesScript.UnlockAchievement(GPGSIds.achievement_achievement_10_points); } else if (score == 15) { PlayGamesScript.UnlockAchievement(GPGSIds.achievement_achievement__15_points); } else if (score == 20) { PlayGamesScript.UnlockAchievement(GPGSIds.achievement_achievement__20_points); } else if (score == 25) { PlayGamesScript.UnlockAchievement(GPGSIds.achievement_achievement__25_points); } else if (score == 30) { PlayGamesScript.UnlockAchievement(GPGSIds.achievement_achievement__30_points); } else if (score == 50) { PlayGamesScript.UnlockAchievement(GPGSIds.achievement_achievement__50_points); } else if (score == 100) { PlayGamesScript.UnlockAchievement(GPGSIds.achievement_achievemet__100_points); } }
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); }
/// <summary> /// A method to handle checking for "Find All Relics" achievement. /// </summary> private void CheckRelicAchievement() { int[] relicLevels = { 16, 23, 35, 40, 51 }; int relics = 0; for (int i = 0; i < relicLevels.Length; i++) { //added to check if the said level already has a levelSaveData if (GameData.Instance.saveData.levelSaveData.Count >= relicLevels[i]) { if (GameData.Instance.saveData.levelSaveData[relicLevels[i] - 1].hasFoundRelic) { //Debug.Log("Relic earned at level:" + GameData.Instance.saveData.levelSaveData[relicLevels[i]]); relics++; } } } if (relics >= 5) { PlayGamesScript.UnlockAchievement("CgkIscHpwIUZEAIQEA"); } }
void Update() { // In the 2-04 level, detect if cheeses are thrown for the achievement if (detectCheeses != null && detectCheeses.Length > 0) { bool cheesesThrown = true; foreach (GameObject cheese in detectCheeses) { if (cheese.transform.position.x > cheeseAreaTop.position.x && cheese.transform.position.x < cheeseAreaBottom.position.x && cheese.transform.position.y < cheeseAreaTop.position.y && cheese.transform.position.y > cheeseAreaBottom.position.y) { cheesesThrown = false; break; } } if (cheesesThrown) { bubble.SetText("RAT_NOT_COOL", 5f); detectCheeses = null; // Achievement PlayGamesScript.UnlockAchievement(GPGSIds.achievement_why_are_you_so_angry); } } }
void Die() { StopAbsorb(); //StopCoroutine ("ThrowingPhase"); StopAllCoroutines(); animator.SetTrigger("die"); Physics2D.IgnoreCollision(GetComponent <Collider2D> (), player.GetComponent <Collider2D> ()); audioSource.Stop(); audioSource.pitch = 0.8f; audioSource.PlayOneShot(bossHitSound); if (enemiesGenerator != null) { enemiesGenerator.GetComponent <EnemiesGenerator>().StopPoping(); } if (lifebar != null) { lifebar.gameObject.SetActive(false); } // Achievement if (isBossFight) { PlayGamesScript.UnlockAchievement(Config.DEFEAT_DOGCATCHER); } }
public void UnlockAchievementTwo() { PlayGamesScript.UnlockAchievement(GPGSIds.achievement_perfect_slice); }
public void Unlock() { PlayGamesScript.UnlockAchievement(GPGSIds.achievement_touch_screen); }
/// <summary> /// A method to handle checking for tier I and II achievements. /// </summary> private void CheckAchievements() { switch (GameData.Instance.currLevelID) { // basic case 3: PlayGamesScript.UnlockAchievement("CgkIscHpwIUZEAIQBA"); break; // trap case 5: PlayGamesScript.UnlockAchievement("CgkIscHpwIUZEAIQBQ"); break; // lever case 9: PlayGamesScript.UnlockAchievement("CgkIscHpwIUZEAIQBg"); break; // finish stage 1 case 20: PlayGamesScript.UnlockAchievement("CgkIscHpwIUZEAIQDQ"); break; // key case 21: PlayGamesScript.UnlockAchievement("CgkIscHpwIUZEAIQBw"); break; // pressure plate case 26: PlayGamesScript.UnlockAchievement("CgkIscHpwIUZEAIQCA"); break; // unproportional case 33: PlayGamesScript.UnlockAchievement("CgkIscHpwIUZEAIQCQ"); break; // finish stage 2 case 40: PlayGamesScript.UnlockAchievement("CgkIscHpwIUZEAIQDg"); break; // triggered timer case 41: PlayGamesScript.UnlockAchievement("CgkIscHpwIUZEAIQCg"); break; // teleporter case 46: PlayGamesScript.UnlockAchievement("CgkIscHpwIUZEAIQCg"); break; // finish stage 3 case 60: PlayGamesScript.UnlockAchievement("CgkIscHpwIUZEAIQDw"); break; } // collect first relic if (RelicCollected) { PlayGamesScript.UnlockAchievement("CgkIscHpwIUZEAIQDA"); } }
public void UnlockScoreRankAchievementFive() { PlayGamesScript.UnlockAchievement(GPGSIds.achievement_grand_master); }
public void UnlockScoreRankAchievementThree() { PlayGamesScript.UnlockAchievement(GPGSIds.achievement_knight); }
public void UnlockScoreRankAchievementTwo() { PlayGamesScript.UnlockAchievement(GPGSIds.achievement_padawan); }
public void UnlockScoreRankAchievementOne() { PlayGamesScript.UnlockAchievement(GPGSIds.achievement_youngling); }