void Awake() { QualitySettings.vSyncCount = 0; Application.targetFrameRate = 30; if (GameData.music) { AudioSource audio = GetComponent <AudioSource>(); audio.Play(); } if (GameData.useServer && GameData.rain > 0.2f) { rainParticleSystem.gameObject.SetActive(true); rainParticleSystem.Play(); if (GooglePlayServices.IsAuthenticated()) { GooglePlayServices.UnlockAchievement(GPGSIds.achievement_raining_day_isnt_it); } } else if (!GameData.useServer) { int r = Random.Range(0, 4); if (r == 0) { rainParticleSystem.gameObject.SetActive(true); rainParticleSystem.Play(); } } }
void OnCollisionEnter2D(Collision2D coll) { if ((coll.gameObject.tag == "Wall" || coll.gameObject.tag == "Enemy") && charging) { if (coll.gameObject.tag == "Enemy") { coll.gameObject.GetComponent <BaseEnemy>().Die(); if (GooglePlayServices.IsAuthenticated()) { GooglePlayServices.UnlockAchievement(GPGSIds.achievement_big_dodger); GooglePlayServices.IncrementAchievement(GPGSIds.achievement_master_of_dodgers, 1); } } this.Die(); } }
//<summary> // Add the score to the global leaderboard if it is the local best result. //</summary> private void ProcessFinalScore() { if (GooglePlayServices.IsAuthenticated()) { string s = GameData.ReadScore(0); if (s != "NONE") { string[] values = s.Split('\t'); uint savedScore = uint.Parse(values[0]); if (savedScore < GameData.last_score) { GooglePlayServices.AddScoreToLeaderboard(GPGSIds.leaderboard_global_leaderboard, GameData.last_score); } } else { GooglePlayServices.AddScoreToLeaderboard(GPGSIds.leaderboard_global_leaderboard, GameData.last_score); } } }
void OnCollisionEnter2D(Collision2D coll) { if (coll.gameObject.tag == "Terrain") { Destroy(this.gameObject); } else if (coll.gameObject.tag == "Enemy") { BaseEnemy en = coll.gameObject.GetComponent <BaseEnemy>(); en.Die(); if (GooglePlayServices.IsAuthenticated()) { GooglePlayServices.UnlockAchievement(GPGSIds.achievement_big_strategist); GooglePlayServices.IncrementAchievement(GPGSIds.achievement_master_strategist, 1); } Destroy(this.gameObject); } }
//<summary> // Unlocks and updates the achievements related to the game based on light, temperature and time. //</summary> private void ProcessAchievement() { if (GooglePlayServices.IsAuthenticated()) { GooglePlayServices.UnlockAchievement(GPGSIds.achievement_first_time); if (GameData.last_light_condition == "Light") { GooglePlayServices.IncrementAchievement(GPGSIds.achievement_player_of_the_day, 1); GooglePlayServices.IncrementAchievement(GPGSIds.achievement_owner_of_the_day, 1); GooglePlayServices.IncrementAchievement(GPGSIds.achievement_master_of_the_day, 1); } else { GooglePlayServices.IncrementAchievement(GPGSIds.achievement_player_of_the_night, 1); GooglePlayServices.IncrementAchievement(GPGSIds.achievement_owner_of_the_night, 1); GooglePlayServices.IncrementAchievement(GPGSIds.achievement_master_of_the_night, 1); } if (GameData.last_temperature_condition == "Cold") { GooglePlayServices.IncrementAchievement(GPGSIds.achievement_master_of_ice, 1); } else if (GameData.last_temperature_condition == "Hot") { GooglePlayServices.IncrementAchievement(GPGSIds.achievement_master_of_fire, 1); } if (GameData.last_time_condition == 12) { GooglePlayServices.UnlockAchievement(GPGSIds.achievement_player_of_midday); } else if (GameData.last_time_condition == 24 || GameData.last_time_condition == 0) { GooglePlayServices.UnlockAchievement(GPGSIds.achievement_player_of_midnight); } } }