// Use this for initialization void Start() { UIObject = GameObject.Find("UIManager"); UIManagerScript = UIObject.GetComponent <UIManager>(); unlockIndex = PlayerPrefs.GetInt("CharacterSelected"); //call CharacterS script CharacterObject = GameObject.Find("CharacterS"); if (CharacterSScript != null) { CharacterSScript = CharacterObject.GetComponent <CharacterS>(); } //unlockIndex = CharacterSScript.index; //make the unseleted buttons invisible foreach (Button button in unlockButton) { button.gameObject.SetActive(false); } //make the selected button visible if (unlockButton[unlockIndex]) { unlockButton[unlockIndex].gameObject.SetActive(true); } //unlockButton[unlockIndex].gameObject.SetActive(false); }
// Use this for initialization void Start() { //set the time as real time in game play modexs Time.timeScale = 1; UnlockObject = GameObject.Find("Unlock"); if (UnlockScript != null) { UnlockScript = UnlockObject.GetComponent <Unlock>(); } CharacterObject = GameObject.Find("CharacterS"); if (CharacterSScript != null) { CharacterSScript = CharacterObject.GetComponent <CharacterS>(); } //game is not over by default gameOver = false; score = 0; UnlockHeroInvisible1 = true; if (PlayerPrefs.GetInt("Unlock2") == 2) { UnlockHeros2 = true; //hide unlock button } else { UnlockHeros2 = false; //show unlock button } if (PlayerPrefs.GetInt("Unlock3") == 3) { UnlockHeros3 = true; } else { UnlockHeros3 = false; } if (PlayerPrefs.GetInt("Unlock4") == 4) { UnlockHeros4 = true; } else { UnlockHeros4 = false; } if (PlayerPrefs.GetInt("Unlock5") == 5) { UnlockHeros5 = true; } else { UnlockHeros5 = false; } if (PlayerPrefs.GetInt("Unlock6") == 6) { UnlockHeros6 = true; } else { UnlockHeros6 = false; } if (PlayerPrefs.GetInt("Unlock7") == 7) { UnlockHeros7 = true; } else { UnlockHeros7 = false; } StartCoroutine(TurnOffTut()); }