// Use this for initialization void Start() { // Build the gameObject. mainPlayer = gameObject.AddComponent <AudioSource> (); secondaryPlayer = gameObject.AddComponent <AudioSource> (); ambientMainPlayer = gameObject.AddComponent <AudioSource> (); ambientSecondaryPlayer = gameObject.AddComponent <AudioSource> (); cardFlipper = gameObject.AddComponent <AudioSource> (); // Everything but card sounds loops mainPlayer.loop = true; secondaryPlayer.loop = true; ambientMainPlayer.loop = true; ambientSecondaryPlayer.loop = true; // Initialize the mainPlayer mainPlayer.clip = defaultSound; // In the beginning there should be somekind of default music mainPlayer.volume = masterVolume * mainVolume; mainPlayer.Play(); // Start playing this song. ambientInfo = ambientSoundInfo.Silence; InvokeRepeating("NextSong", 0f, 45f); }
public void ChangeAmbient(ambientSoundInfo ambientInfo) { changedEnvironments = true; this.ambientInfo = ambientInfo; }