public void PlayPlaceMusic(EnvironmentManager.Place place) { switch (place) { case EnvironmentManager.Place.Title_Screen: backgroundMusic.Fade(titleMusic, MAX_VOLUME, true); //start the kitchen background noises foley.ToggleSound(OnOrOff.On); foley.Fade(kitchenBackgroundSFX, MAX_VOLUME, true); break; case EnvironmentManager.Place.Kitchen: backgroundMusic.Fade(kitchenMusic, MAX_VOLUME, true); //start the kitchen background noises foley.ToggleSound(OnOrOff.On); foley.Fade(kitchenBackgroundSFX, MAX_VOLUME, true); break; case EnvironmentManager.Place.Tavern: backgroundMusic.Fade(tavernMusic, MAX_VOLUME, true); foley.Fade(tavernBackgroundSFX, MAX_VOLUME, true); break; case EnvironmentManager.Place.Battlefield: //start the sword-clashing background sound foley.Fade(battleBackgroundSFX, MAX_VOLUME, true); break; } currentMusic = backgroundMusic.GetCurrentClip(); }
private readonly Color ambientColor; //the color of the ambient light ///////////////////////////////////////////// /// Functions ///////////////////////////////////////////// //constructor public ChangeEnvironmentTask(EnvironmentManager.Place newPlace, EnvironmentManager.Place oldPlace, Color ambientColor) { environment = GameObject.Find(ENVIRONMENT_ORGANIZER).transform; this.newPlace = newPlace; this.oldPlace = oldPlace; this.ambientColor = ambientColor; }
///////////////////////////////////////////// /// Functions ///////////////////////////////////////////// //initialize variables, and then start the audio for the appropriate environment public void Setup(EnvironmentManager.Place place) { errorClip = Resources.Load <AudioClip>(MUSIC_PATH + Clips.Error.ToString()); titleMusic = Resources.Load <AudioClip>(MUSIC_PATH + Clips.Komiku_Barque_sur_le_Lac.ToString()); kitchenMusic = Resources.Load <AudioClip>(MUSIC_PATH + Clips.Doctor_Turtle_It_Looks_Like_the_Future_but_Feels_Like_the_Past.ToString()); tavernMusic = Resources.Load <AudioClip>(MUSIC_PATH + Clips.Komiku_Pirates_Libertaires.ToString()); pauseMusic = Resources.Load <AudioClip>(MUSIC_PATH + Clips.Komiku_Chill_Out_Theme.ToString()); backgroundMusic = new FadingAudioSource(GameObject.Find(AUDIO_ORGANIZER).transform.Find(MUSIC_SPEAKER).GetComponent <AudioSource>(), Clips.Error, MAX_VOLUME, true, false); kitchenBackgroundSFX = Resources.Load <AudioClip>(SFX_PATH + Clips.Kitchen_SFX.ToString()); tavernBackgroundSFX = Resources.Load <AudioClip>(SFX_PATH + Clips.Tavern_SFX.ToString()); battleBackgroundSFX = Resources.Load <AudioClip>(SFX_PATH + Clips.Battlefield_SFX.ToString()); foley = new FadingAudioSource(GameObject.Find(AUDIO_ORGANIZER).transform.Find(FOLEY_SPEAKER).GetComponent <AudioSource>(), Clips.Error, MAX_VOLUME, true, false); PlayPlaceMusic(place); }