/// <summary> /// Stop the background music. /// </summary> public void Stop() { if (_activeBackgroundMusic == this) { Managers.SoundManager.StopMusic(); _activeBackgroundMusic = null; } _isPlaying = false; }
/// <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); }
/// <summary> /// Play the background music (will replace currently playing music). /// </summary> public void Play() { _isPlaying = true; Managers.SoundManager.PlayMusic(MusicAssetPath, IsRepeating, Volume); _activeBackgroundMusic = this; }