示例#1
0
 /// <summary>
 /// Stop the background music.
 /// </summary>
 public void Stop()
 {
     if (_activeBackgroundMusic == this)
     {
         Managers.SoundManager.StopMusic();
         _activeBackgroundMusic = null;
     }
     _isPlaying = false;
 }
示例#2
0
        /// <summary>
        /// Clone this background music component.
        /// </summary>
        /// <returns>Cloned copy of this component.</returns>
        override public BaseComponent Clone()
        {
            BackgroundMusic ret = new BackgroundMusic(MusicAssetPath);

            CopyBasics(ret);
            ret.Volume      = Volume;
            ret.IsRepeating = IsRepeating;
            ret.PlayOnSpawn = PlayOnSpawn;
            ret._isPlaying  = _isPlaying;
            return(ret);
        }
示例#3
0
 /// <summary>
 /// Play the background music (will replace currently playing music).
 /// </summary>
 public void Play()
 {
     _isPlaying = true;
     Managers.SoundManager.PlayMusic(MusicAssetPath, IsRepeating, Volume);
     _activeBackgroundMusic = this;
 }