void InitializeButton() { button.interactable = false; stars [0].SetActive(false); stars [1].SetActive(false); stars [2].SetActive(false); starsHolder.SetActive(false); padlock.SetActive(true); if (PlayerPrefsController.GetLevel(level)) { button.interactable = PlayerPrefsController.GetLevel(level); starsHolder.SetActive(button.interactable); padlock.SetActive(!button.interactable); switch (PlayerPrefsController.GetStars(level)) { case 1: stars [0].SetActive(true); break; case 2: stars [0].SetActive(true); stars [1].SetActive(true); break; case 3: stars [0].SetActive(true); stars [1].SetActive(true); stars [2].SetActive(true); break; } } }
void UnlockNextLevel() { if (level < 3 && !PlayerPrefsController.GetLevel(level + 1)) { PlayerPrefsController.SetLevel(level + 1); } }
private void ResetPlayerNameAndScore(int index) { playerText[index].text = PlayerPrefsController.GetPlayer(index + 1); scoreText[index].text = PlayerPrefsController.GetScore(index + 1) == 0 ? "-" : PlayerPrefsController.GetScore(index + 1).ToString(); levelText[index].text = PlayerPrefsController.GetScore(index + 1) == 0 ? "-" : PlayerPrefsController.GetLevel(index + 1); }