Platformer Pro  2.3.2
A platform game kit for Unity.
PlatformerPro.MusicPlayer Class Reference

Music player which provides basic operations for playing/pausing/stopping music. More...

Inheritance diagram for PlatformerPro.MusicPlayer:

Public Member Functions

virtual void UpdateVolume ()
 Updates the volume. More...
 
virtual void Play ()
 Play the first song in the playlist. More...
 
virtual void Play (string songName)
 Play the specified song. More...
 
virtual void PlayNext ()
 Play the next song. More...
 
virtual void Pause ()
 Pause the music. More...
 
virtual void Stop ()
 Stop the music. More...
 
virtual void FadeOut (float time)
 Fade the music out over time. More...
 
virtual void FadeIn (float time)
 Fade the music in over time. More...
 

Public Attributes

List< SongDataplaylist
 The song data. More...
 
bool playOnStart
 Should we play the first song straight away? More...
 
bool autoPlayNextSong
 Should we start playing the next song automatically. More...
 
bool randomiseSong
 If true the song that is played is selected randomly. More...
 

Protected Member Functions

virtual void Init ()
 
virtual IEnumerator DoFadeOut (float time)
 Fades out. More...
 
virtual IEnumerator DoFadeIn (float time)
 Fades in. More...
 

Protected Attributes

AudioSource audioSource
 Cached reference to the audioSource; More...
 
int currentSong = 0
 The current song index. More...
 
float currentSongTime
 

Static Protected Attributes

const float nextSongDelay = 0.33f
 How long to wait before playing the next song. More...
 
const float songEndDelta = 0.1f
 Difference between clip length and current time which we still considere to be end of song. More...
 

Detailed Description

Music player which provides basic operations for playing/pausing/stopping music.

Member Function Documentation

◆ DoFadeIn()

virtual IEnumerator PlatformerPro.MusicPlayer.DoFadeIn ( float  time)
protectedvirtual

Fades in.

◆ DoFadeOut()

virtual IEnumerator PlatformerPro.MusicPlayer.DoFadeOut ( float  time)
protectedvirtual

Fades out.

◆ FadeIn()

virtual void PlatformerPro.MusicPlayer.FadeIn ( float  time)
virtual

Fade the music in over time.

Parameters
timeTime.

◆ FadeOut()

virtual void PlatformerPro.MusicPlayer.FadeOut ( float  time)
virtual

Fade the music out over time.

Parameters
timeTime taken to fade to 0.

◆ Init()

virtual void PlatformerPro.MusicPlayer.Init ( )
protectedvirtual

◆ Pause()

virtual void PlatformerPro.MusicPlayer.Pause ( )
virtual

Pause the music.

◆ Play() [1/2]

virtual void PlatformerPro.MusicPlayer.Play ( )
virtual

Play the first song in the playlist.

◆ Play() [2/2]

virtual void PlatformerPro.MusicPlayer.Play ( string  songName)
virtual

Play the specified song.

Parameters
songNameSong name.

◆ PlayNext()

virtual void PlatformerPro.MusicPlayer.PlayNext ( )
virtual

Play the next song.

◆ Stop()

virtual void PlatformerPro.MusicPlayer.Stop ( )
virtual

Stop the music.

◆ UpdateVolume()

virtual void PlatformerPro.MusicPlayer.UpdateVolume ( )
virtual

Updates the volume.

Member Data Documentation

◆ audioSource

AudioSource PlatformerPro.MusicPlayer.audioSource
protected

Cached reference to the audioSource;

◆ autoPlayNextSong

bool PlatformerPro.MusicPlayer.autoPlayNextSong

Should we start playing the next song automatically.

◆ currentSong

int PlatformerPro.MusicPlayer.currentSong = 0
protected

The current song index.

◆ currentSongTime

float PlatformerPro.MusicPlayer.currentSongTime
protected

◆ nextSongDelay

const float PlatformerPro.MusicPlayer.nextSongDelay = 0.33f
staticprotected

How long to wait before playing the next song.

◆ playlist

List<SongData> PlatformerPro.MusicPlayer.playlist

The song data.

◆ playOnStart

bool PlatformerPro.MusicPlayer.playOnStart

Should we play the first song straight away?

◆ randomiseSong

bool PlatformerPro.MusicPlayer.randomiseSong

If true the song that is played is selected randomly.

◆ songEndDelta

const float PlatformerPro.MusicPlayer.songEndDelta = 0.1f
staticprotected

Difference between clip length and current time which we still considere to be end of song.


The documentation for this class was generated from the following file: