Class Music
- Namespace
- TinyLife
- Assembly
- TinyLife.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 = 0.1)
Parameters
timeTimeSpanThe amount of time to duck for.
duckVolumefloatThe 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
songSongThe song to play.
occasionsOccasion[]The occasions that this song should be allowed to play on.
Exceptions
- ArgumentException
Thrown if
occasionsis empty.