void changeToThisSong(AudioClip clip) { player.Stop(); player.loop = true; player.clip = clip; player.Play(); swapVariable = nowPlaying; }
// Update is called once per frame void Update() { player.volume = volumeSlider / 100; if (swapVariable != nowPlaying) { switch (nowPlaying) { case allMusics.NONE: player.Stop(); swapVariable = nowPlaying; break; case allMusics.TWENTIETH_C: changeToThisSong(twentiethCentuary); break; case allMusics.TWENTIETH_C_ZOMBIEMAN: changeToThisSong(twentiethZombieman); break; case allMusics.ALARM: changeToThisSong(alarm); break; case allMusics.LOOP: changeToThisSong(loop); break; case allMusics.MELANCHOLY_FAST: changeToThisSong(melancholyFast); break; case allMusics.PUHEGEN_TEST: changeToThisSong(puhegenTest); break; case allMusics.SYNKKY: changeToThisSong(synkky); break; case allMusics.TAUSTA_AMBIENT: changeToThisSong(taustaAmbient); break; case allMusics.ZOMBIEMAN: changeToThisSong(zombieman); break; case allMusics.HAUNTING: changeToThisSong(haunting); break; case allMusics.CREDITS: changeToThisSong(credits); break; case allMusics.BASSOPIANOTHEME: changeToThisSong(bassoPiano); break; case allMusics.HEARTBEATVALINTA: changeToThisSong(heartbeatValinta); break; case allMusics.KUUMOTTELU: changeToThisSong(kuumottelu); break; case allMusics.NATUREAMBIENCE: changeToThisSong(natureAmbient); break; case allMusics.OCEAN: changeToThisSong(ocean); break; default: break; } } }
public void changeSong(allMusics music) { nowPlaying = music; }
public void stopAllAudio() { nowPlaying = allMusics.NONE; }