Пример #1
0
    //Set up speakers when player touches the trigger
    void SetSpeakers()
    {
        sources = new List <AudioSource>();

        //Clear sources in case resetting game messes it up
        sources.Clear();
        foreach (GameObject s in speakersOn)
        {
            sources.Add(s.GetComponent <AudioSource>());
        }

        //Mute all other speakers in scene using dynamic music object
        music = GameObject.FindGameObjectWithTag("Music").GetComponent <DynamicMusic>();
        music.MuteAll();

        //Set relevant speakers on with appropriate spatialisation
        foreach (AudioSource s in sources)
        {
            SetSpatialize(s, music3D);
        }
    }