// Start is called before the first frame update void Start() { foreach (ScriptableLevel level in levels._levels) { _selector.CreateNewItem(level.name); _selector.defaultIndex = 0; } ChosenLevel(_selector.index); }
// Start is called before the first frame update void Start() { if (PlayerPrefs.GetInt("sound") == 1 || !PlayerPrefs.HasKey("sound")) { AudioListener.volume = 1f; volumeSwitch.isOn = true; volumeText.text = "Volume On"; } else { AudioListener.volume = 0f; volumeSwitch.isOn = false; volumeText.text = "Volume Off"; } tapPrompt.gameObject.SetActive(false); canPlayPowerupSound = true; sl = slide.GetComponent <Slider>(); powerupSlider = slide; powerupActive = false; powerupButton.gameObject.SetActive(false); increasePower = false; theLeaderboard = FindObjectOfType <Leaderboards>(); perfectsText.color = goodCol; co = StartCoroutine(FadeFeedback()); feedbackText.gameObject.SetActive(false); theAudioManager = FindObjectOfType <AudioManager>(); winScreenBuffer = true; debugText.text = ""; theQualityController = FindObjectOfType <QualityController>(); theScoreManager = FindObjectOfType <ScoreManager>(); lcAnim = levelCompletionScreen.GetComponent <Animator>(); theStackSpawner = FindObjectOfType <StackSpawner>(); theLevelController = FindObjectOfType <LevelController>(); titleImageAnimator = titleImage.GetComponent <Animator>(); titleImageAnimator.SetBool("inGame", false); CutSceneUI.SetActive(false); // StartCoroutine(InitSettings()); //set resolution options if (resSelector.itemList.Count == 0) { theQualityController.resolutions = new Vector2[theQualityController.resolutionCount]; for (int i = theQualityController.resolutionCount; i > 0; i--) { theQualityController.resolutions[i - 1] = new Vector2(3 * Display.main.systemWidth / (i + 2), 3 * Display.main.systemHeight / (i + 2)); resSelector.CreateNewItem("" + (int)theQualityController.resolutions[i - 1].x + " X " + (int)theQualityController.resolutions[i - 1].y); } } //set quality options if (qualSelector.itemList.Count == 0) { for (int i = 0; i < qualityNames.Length; i++) { qualSelector.CreateNewItem(qualityNames[i]); } } //set waterfall options if (waterfallQualSelector.itemList.Count == 0) { for (int i = 0; i < waterfallQualityNames.Length; i++) { waterfallQualSelector.CreateNewItem(waterfallQualityNames[i]); } } if (PlayerPrefs.HasKey("res")) { theQualityController.SetResolution(PlayerPrefs.GetInt("res")); } if (PlayerPrefs.HasKey("qual")) { theQualityController.SetQuality(PlayerPrefs.GetInt("qual")); } else { QualitySettings.SetQualityLevel(5, true); } if (PlayerPrefs.HasKey("waterfallQual")) { theQualityController.SetWaterfallQuality(PlayerPrefs.GetInt("waterfallQual")); } else { PlayerPrefs.SetInt("waterfallQual", 2); theQualityController.SetWaterfallQuality(2); } multiplierText.text = ""; theStackSpawner.levelMarkers = new GameObject[theLevelController.levelRequirements.Length]; if (!PlayerPrefs.HasKey("mode")) { theStackSpawner.StartCoroutine(theStackSpawner.SpawnLevelMarker()); PlayerPrefs.SetString("mode", "level"); } else { theStackSpawner.StartCoroutine(theStackSpawner.SpawnLevelMarker()); } }