void Awake() { if (PlayerPrefs.GetString("HasPlayed") == "Yes") { ScriptLevelRatings.LoadData(); for (int i = 0; i < levelButtons.Length; i++) { if (i != levelButtons.Length - 1 && ScriptLevelRatings.Ratings[i] > 0) { levelButtons[i + 1].GetComponent <Button>().interactable = true; } } } else { ScriptLevelRatings.Initialize(); ScriptLevelRatings.SaveData(); PlayerPrefs.SetString("HasPlayed", "Yes"); } for (int i = 0; i < levelButtons.Length; i++) { levelButtons[i].transform.GetChild(0).GetComponent <Image>().fillAmount = ScriptLevelRatings.Ratings[i] / 3f; } _MainMenu(); }
void Start() { gameplayUI.SetActive(true); resultsScreen.SetActive(false); if (ScriptLevelRatings.currentLevel == 5 || ScriptLevelRatings.GetCurrentLevelRating() == 0) { nextLevelButton.interactable = false; } if (cannon == null) { cannon = GameObject.FindGameObjectWithTag("Cannon").GetComponent <ScriptCanon>(); } }
public void _MainMenu() { ScriptLevelRatings.SaveData(); SceneManager.LoadScene(0); }
void OnApplicationPause() { ScriptLevelRatings.SaveData(); }
public void _ResetProgress() { ScriptLevelRatings.Initialize(); ScriptLevelRatings.SaveData(); }
public void _Quit() { ScriptLevelRatings.SaveData(); Application.Quit(); }