IEnumerator finishPanelShowing() { ++finishPanelSafetyNet; yield return(new WaitForSeconds(1f)); if ((!GameObject.FindGameObjectWithTag("sheepy") && !GameObject.FindGameObjectWithTag("blacky")) || finishPanelSafetyNet > 2) { musicManager.GetComponent <music>().UISFX(4); PlayServicesMyVersion psvm = GameObject.Find("Music Manager").GetComponent <PlayServicesMyVersion>(); psvm.addValueToLeaderbord(GPGSIds.leaderboard_most_money_earned, PlayerPrefs.GetInt("mostMoney")); psvm.addValueToLeaderbord(GPGSIds.leaderboard_most_sheep_caught, PlayerPrefs.GetInt("mostSheepy")); psvm.unlockPartialAchievement(GPGSIds.achievement_car_crasher, (double)PlayerPrefs.GetInt("carsCrushed") / 50); psvm.unlockPartialAchievement(GPGSIds.achievement_car_crasher, (double)PlayerPrefs.GetInt("snowCrushed") / 50); psvm.addValueToLeaderbord(GPGSIds.leaderboard_obstacles_destroyed, PlayerPrefs.GetInt("snowCrushed") + PlayerPrefs.GetInt("carsCrushed")); psvm.unlockPartialAchievement(GPGSIds.achievement_catch_1000_sheeps, (double)PlayerPrefs.GetInt("mostSheepy") / 1000); psvm.unlockPartialAchievement(GPGSIds.achievement_catch_2500_sheeps, (double)PlayerPrefs.GetInt("mostSheepy") / 2500); psvm.unlockPartialAchievement(GPGSIds.achievement_catch_5000_sheeps, (double)PlayerPrefs.GetInt("mostSheepy") / 5000); psvm.unlockPartialAchievement(GPGSIds.achievement_catch_7500_sheeps, (double)PlayerPrefs.GetInt("mostSheepy") / 7500); psvm.unlockPartialAchievement(GPGSIds.achievement_catche_10000_sheeps, (double)PlayerPrefs.GetInt("mostSheepy") / 10000); PlayerPrefs.SetInt("sheepy", totalSheepsCaught); //i wish i was focused enough to find a more beautiful way of assigning values but... //it's been a long 3 months working on this 'game' and i honestly jst wanna get it over with. //update: it s been 5 month now and it s publishing time, i hope it was worth it ! StartCoroutine(objectOpened(finishPanel)); finishPanel.transform.GetChild(1).GetComponentInChildren <TextMeshProUGUI>().text = "+" + (score - originalScore); if (SceneManager.GetActiveScene().name.Equals("Farm")) { finishPanel.transform.GetChild(2).GetComponentInChildren <TextMeshProUGUI>().text = "+" + sheepyCaught; finishPanel.transform.GetChild(3).GetComponentInChildren <TextMeshProUGUI>().text = "+" + blackyCaught; } if (SceneManager.GetActiveScene().name.Equals("Snow")) { finishPanel.transform.GetChild(2).GetComponentInChildren <TextMeshProUGUI>().text = "+" + snowSheepyCaught; finishPanel.transform.GetChild(3).GetComponentInChildren <TextMeshProUGUI>().text = "+" + snowBlackyCaught; } if (SceneManager.GetActiveScene().name.Equals("City")) { finishPanel.transform.GetChild(2).GetComponentInChildren <TextMeshProUGUI>().text = "+" + citySheepyCaught; finishPanel.transform.GetChild(3).GetComponentInChildren <TextMeshProUGUI>().text = "+" + cityBlackyCaught; } finishPanel.transform.GetChild(4).GetComponentInChildren <TextMeshProUGUI>().text = "+" + flashCaught; } else { StartCoroutine(finishPanelShowing()); } }
public void farm() { if (PlayerPrefs.GetInt("hearts") > 0) { musicManager.GetComponent <music>().BackgroundMusic(1); musicManager.UISFX(0); if (PlayerPrefs.GetInt("tuto") == 1) { PlayerPrefs.SetInt("tuto", PlayerPrefs.GetInt("tuto") + 1); } PlayerPrefs.SetInt("hearts", PlayerPrefs.GetInt("hearts") - 1); LoadingScreenManager.sceneToLoad = 3; SceneManager.LoadScene(4); } else { openNoHeartPanel(); } }