public void ResetSettings() { SoundManager.instance.Play(SoundManager.clip.ButtonClick); saveScript.dataBase.firstDB[1].value = 1; saveScript.Save(); slider.ResetSlider(); }
public void RegisterAudio() { float volume = slider.value; float vibration = (130 * volume); if (!Application.isEditor) { VibrationController.Vibrate((long)vibration); } if (volume >= 0) { xmlSystem.dataBase.firstDB[1].value = volume; xmlSystem.Save(); } }
IEnumerator SpawnWaves() { yield return(new WaitForSeconds(waitBeforeStart)); //Wait before spawning first wave foreach (Wave wave in waves) { GameObject enemy = Instantiate(GetEnemy(wave.toSpawn), GetSpawnPosition(wave.zoneToSpawn).position, Quaternion.identity); //Instantiate enemy in correct zone enemy.transform.parent = GetSpawnPosition(wave.zoneToSpawn); //Put the enemy in the zone transform enemy.GetComponent <EnemyControls>().DropUpgrade = wave.spawnUpgrade; enemy.transform.position = Vector3.zero; //Set the enemy position to the zone transform position currentEnemies.Add(enemy); //Add the enemy to the list enemy.tag = "Enemy"; //Set the tag of the enemies //If the wave need to wait before spawning the next wave if (wave.waitUntilDestruction) { while (currentEnemies.Count > 0) //Check if all the enemies are destroyed { yield return(new WaitForSeconds(0.1f)); } } yield return(new WaitForSeconds(wave.timeBeforeSpawnNext)); DrawBar();//Draw progress bar } while (currentEnemies.Count > 0) { yield return(new WaitForSeconds(0.1f)); //Wait for all enemies to die } //Save level saveSystem.Load(); if (saveSystem.dataBase.firstDB[0].value < levelID) { saveSystem.dataBase.firstDB[0].value = levelID; saveSystem.Save(); } //Tell that the level has ended isEndLevel = true; }