Exemplo n.º 1
0
    //Intialize all sounds with a Game object and AudioSource
    void Start()
    {
        //Background music initialization
        GameObject mainSound = new GameObject(music.soundID);

        music.SetSource(mainSound.AddComponent <AudioSource>());

        //Sound Effects initialization
        for (int i = 0; i < soundFx.Length; i++)
        {
            GameObject effect = new GameObject(soundFx[i].soundID);
            soundFx[i].SetSource(effect.AddComponent <AudioSource>());
        }

        PlaySound("Theme");
    }