void Start() { OptionsBack = GameObject.Find("OptionsBack").GetComponent <Button>(); if (!PlayerPrefs.HasKey("CurrentSkin")) { PlayerPrefs.SetInt("CurrentSkin", 0); } currentSkin = PlayerPrefs.GetInt("CurrentSkin"); if (!PlayerPrefs.HasKey("MusicVolume")) { PlayerPrefs.SetInt("MusicVolume", 100); } MusicVolume = PlayerPrefs.GetInt("MusicVolume"); if (!PlayerPrefs.HasKey("SFXVolume")) { PlayerPrefs.SetInt("SFXVolume", 100); } SFXVolume = PlayerPrefs.GetInt("SFXVolume"); MusicVolumeSlider.value = MusicVolume; SFXVolumeSlider.value = SFXVolume; updateSkinText(); UpdateMusicVolume(); UpdateSFXVolume(); ToMain(); EditUI.SetActive(false); PauseMenu.SetActive(false); Debug.Log("generate buttons"); int xPos = 60; int yPos = -20; VisualMapGenerator mapCont = GameObject.Find("MapController").GetComponent <VisualMapGenerator>(); for (int i = 0; i < mapCont.MapCount; i++) { GameObject button = Instantiate(LevelSelectButton, LevelSelectScroll.transform); button.transform.localPosition = new Vector3(xPos, yPos, 0); int temp = i; button.GetComponent <Button>().onClick.AddListener(delegate { mapCont.StartGame(temp); }); button.GetComponent <Button>().onClick.AddListener(delegate { ToGame(); }); button.GetComponentInChildren <Text>().text = "Level " + (i + 1); xPos += 90; if (xPos > 420) { xPos = 60; yPos -= 50; } if (PlayerPrefs.GetInt("UnlockedLevel" + i, 0) == 0) { GameObject locked = Instantiate(LevelLock, button.transform); locked.name = "LockLevel" + i; } } }
void Start() { mappyBoi = GetComponentInParent <VisualMapGenerator>(); }