Class Music
- Namespace
- TinyLife
- Assembly
- Tiny Life.dll
This class handles the game's in-game music. To register new music tracks for being selected, use Register(Song, params Occasion[]).
public static class Music
- Inheritance
-
Music
- Inherited Members
Methods
Duck(TimeSpan, float)
Reduces the volume of the currently playing music to the given duckVolume
for the given amount of time
.
This is useful when playing a sound effect that is considered more important than the music.
public static void Duck(TimeSpan time, float duckVolume)
Parameters
time
TimeSpanThe amount of time to duck for.
duckVolume
floatThe volume to duck the music to, which is automatically multiplied by MusicVolume.
Register(Song, params Occasion[])
Registers a new music track to be played at the given occasions
.
The music track will be added to the music pool and randomly selected for playing.
public static void Register(Song song, params Music.Occasion[] occasions)
Parameters
song
SongThe song to play.
occasions
Occasion[]The occasions that this song should be allowed to play on.
Exceptions
- ArgumentException
Thrown if
occasions
is empty.