Esempio n. 1
0
 void Start()
 {
     spawnPoints   = GameObject.FindGameObjectsWithTag("Spawners");
     spawnInterval = timeSpawn;
     planetSkin    = defaultCharObj;
     Invoke("SetDefaultSkin", 0.1f);
     gameSound = _earth.gameObject.GetComponent <AsteroidSounds>();
     audDist   = _earth.gameObject.GetComponent <AudioDistortionFilter>();
 }
    void Awake()
    {
        //Check if there is already an instance of SoundManager
        if (instance == null)
        {
            //if not, set it to this.
            instance = this;
        }
        //If instance already exists:

        //Set SoundManager to DontDestroyOnLoad so that it won't be destroyed when reloading our scene.
        DontDestroyOnLoad(gameObject);

        audioOn = GetSoundOptions();

        musicClips = Random.Range(0, music.Length);
        PlanetManager.instance.GameRestarted.AddListener(CheckAudio);
    }