Exemple #1
0
    /// <summary>
    /// Plays the specified BGM.
    /// </summary>
    public override SoundObject PlayBGM(SoundInfo.BGMID soundID, bool setPersistent = false)
    {
        SoundObject bgm = base.PlayBGM(soundID, setPersistent);

        bgm.transform.parent = this.transform;
        return(bgm);
    }
Exemple #2
0
    /// <summary>
    /// Plays the BGM of the given id
    /// </summary>
    /// <param name="bgmId">id.</param>
    private void PlayBGMWithID(SoundInfo.BGMID bgmID)
    {
        if (bgmID == SoundInfo.BGMID.SIZE)
        {
            return;
        }

        // Stop the current BGM first
        StopBGM();

        // Play the new one and update the index
        int i = (int)bgmID;

        if (m_bgmArray[i] == null)
        {
            m_bgmArray[i] = Locator.GetSoundSystem().PlayBGM(bgmID, true);
            m_bgmArray[i].transform.parent = transform;
            if (!m_soundsOn)
            {
                m_bgmArray[i].Mute();
            }
        }
        else
        {
            m_bgmArray[i].Play(true);
        }

        // Update the index
        m_currentBGMID = bgmID;
    }
    /// <summary>
    /// Plays the specified BGM.
    /// </summary>
    public virtual SoundObject PlayBGM(SoundInfo.BGMID soundID, bool setPersistent = false)
    {
        SoundObject bgm = CreateSoundObject(soundID, setPersistent);

        bgm.Initialize(this, SoundInfo.SoundType.BGM, !m_areSoundsOn);
        bgm.Play();
        return(bgm);
    }
Exemple #4
0
 public abstract SoundObject PlayBGM(SoundInfo.BGMID soundID, bool setPersistent = false);
 /// <summary>
 /// Creates a SoundObject for the specified BGM.
 /// </summary>
 /// <returns>The sound object.</returns>
 /// <param name="sfxID">BGM ID.</param>
 private SoundObject CreateSoundObject(SoundInfo.BGMID bgmID, bool setPersistent = false)
 {
     return(CreateSoundObject(m_bgmResources[(int)bgmID], setPersistent));
 }