// Advance to the next level void gotoNextLevel() { MusicPlayer.instance.PlaySoundEffect(MusicPlayer.instance.keyCollected, 1); if (!system.isCatCollected(currentLevel)) { spawnCat(currentLevel); } if (currentLevel <= 10) { currentLevel += 1; } GameObject obj = Instantiate(levelIndicator); obj.transform.SetParent(UICanvas, false); system.clearLevel(currentLevel); if (currentLevel < 11) { loadLevel(currentLevel); } else { Debug.Log("You are winrar"); } }
void addDelegateOrRemove(int i) { if (system.getClearedLevels() > i - 1) { GameObject.Find("MainCanvas/level" + (i)).GetComponent <Button> ().onClick.AddListener(delegate { this.levelButtonClicked(i); }); } else { //Destroy (GameObject.Find ("MainCanvas/level" +(i))); Button but = GameObject.Find("MainCanvas/level" + (i)).GetComponent <Button>(); ColorBlock cb = but.colors; cb.normalColor = new Color(1.0f, 1.0f, 1.0f, 0.4f); cb.pressedColor = new Color(1.0f, 1.0f, 1.0f, 0.4f); cb.highlightedColor = new Color(1.0f, 1.0f, 1.0f, 0.4f); but.colors = cb; } if (!system.isCatCollected(i)) { Destroy(GameObject.Find("MainCanvas/level" + (i) + "/cat_l" + (i))); } }