// Handle Click events void OnMouseDown() { switch (gameObject.tag) { case "PlayButton": GPS.AwardAchievement("FirstGame"); Scene_To_Load = "MainGame"; gameObject.GetComponent <SpriteRenderer> ().sprite = Resources.Load <Sprite> ("Sprites/Ui/Play_Down"); break; case "CharactersButton": gameObject.GetComponent <SpriteRenderer> ().sprite = Resources.Load <Sprite> ("Sprites/Ui/Characters_Down"); break; case "RetryButton": gameObject.GetComponent <SpriteRenderer> ().sprite = Resources.Load <Sprite> ("Sprites/Ui/Retry_Down"); break; case "HomeButton": gameObject.GetComponent <SpriteRenderer>().sprite = Resources.Load <Sprite> ("Sprites/Ui/Home_Down"); break; case "SettingsButton": Scene_To_Load = "Settings"; gameObject.GetComponent <SpriteRenderer>().sprite = Resources.Load <Sprite> ("Sprites/Ui/Settings_Down"); break; case "AchievementsButton": Scene_To_Load = "StartMenu"; gameObject.GetComponent <SpriteRenderer>().sprite = Resources.Load <Sprite> ("Sprites/Ui/Achievements_Down"); break; case "LeaderboardsButton": Scene_To_Load = "StartMenu"; gameObject.GetComponent <SpriteRenderer>().sprite = Resources.Load <Sprite> ("Sprites/Ui/Leaderboard_Down"); break; case "ChooseCharacterButton": gameObject.GetComponent <SpriteRenderer> ().sprite = Resources.Load <Sprite> ("Sprites/Ui/Characters_Choose_Down"); break; case "RightScroll": gameObject.GetComponent <SpriteRenderer> ().sprite = Resources.Load <Sprite> ("Sprites/Ui/Scroll_Down"); break; case "LeftScroll": gameObject.GetComponent <SpriteRenderer> ().sprite = Resources.Load <Sprite> ("Sprites/Ui/Scroll_Down"); break; case "ReviveButton": NotificationManager.chosen = NotificationManager.optionChosen.revive; break; case "NopeButton": NotificationManager.chosen = NotificationManager.optionChosen.norevive; break; } }
void RunGameOver() { //award first game achievement if applicable! if (isFirstGame == true) { GPS.AwardAchievement("FirstGame"); } foreach (Object obj in All_Obstacles) { Destroy(obj); } canReset = true; StartCoroutine("AnimateScore"); }
IEnumerator AnimateScore() { GameObject Medal_Gold = Resources.Load("Sprites/Ui/Prefabs/Medal_Gold") as GameObject; GameObject Medal_Silver = Resources.Load("Sprites/Ui/Prefabs/Medal_Silver") as GameObject; GameObject Medal_Bronze = Resources.Load("Sprites/Ui/Prefabs/Medal_Bronze") as GameObject; for (int score_tick = 1; score_tick <= score; score_tick++) { if (score_tick != 1) { scoreReadout.GetComponent <TextMesh> ().text = (score_tick + " meters"); } else { scoreReadout.GetComponent <TextMesh> ().text = (score_tick + " meter"); } //handle medals if (score_tick == 10) { //award bronze medal GameObject Bronze = Instantiate(Medal_Bronze, new Vector3(Camera.main.transform.position.x, 3.9f, 0f), identity) as GameObject; GPS.AwardAchievement("Bronze"); } else if (score_tick == 25) { //award silver medal GameObject Silver = Instantiate(Medal_Silver, new Vector3(Camera.main.transform.position.x, 3.9f, 0f), identity) as GameObject; GPS.AwardAchievement("Silver"); } else if (score_tick == 50) { //award silver medal GameObject Gold = Instantiate(Medal_Gold, new Vector3(Camera.main.transform.position.x, 3.9f, 0f), identity) as GameObject; GPS.AwardAchievement("Gold"); } yield return(new WaitForSeconds(0.1f)); } }