Example #1
0
    /// <summary>
    /// Plays the specified sound once, and deletes the sound object after playback.
    /// </summary>
    public override void PlayOneShot(SoundInfo.SFXID soundID)
    {
        SoundObject oneShotSFX = CreateSoundObject(soundID);

        oneShotSFX.Initialize(this, SoundInfo.SoundType.ONE_SHOT, !m_areSoundsOn);
        oneShotSFX.Play();
    }
    /// <summary>
    /// Plays the specified sound.
    /// </summary>
    public virtual SoundObject PlaySound(SoundInfo.SFXID soundID)
    {
        SoundObject sound = CreateSoundObject(soundID);

        sound.Initialize(this, SoundInfo.SoundType.REGULAR, !m_areSoundsOn);
        sound.Play();
        return(sound);
    }
Example #3
0
 /// <summary>
 /// Plays a new win/lose SFX.
 /// </summary>
 /// <param name="sfxID">Sfx I.</param>
 private void PlayNewWinLoseSFX(SoundInfo.SFXID sfxID)
 {
     if (m_winLoseSFX != null)
     {
         m_winLoseSFX.Delete();
     }
     m_winLoseSFX = Locator.GetSoundSystem().PlaySound(sfxID);
 }
    /// <summary>
    /// Private version of PlayOneShot.
    /// Returns a SoundObject that sound manager classes can handle as needed.
    /// Note that one-shot SoundObjects self-destruct upon finishing playback, so
    /// the SoundObject handles for these sounds will be handling nothing.
    /// </summary>
    protected SoundObject PlayOneShotInternal(SoundInfo.SFXID soundID, Vector3 pos)
    {
        SoundObject oneShotSFX = CreateSoundObject(soundID);

        oneShotSFX.transform.parent   = this.transform;
        oneShotSFX.transform.position = pos;
        oneShotSFX.Initialize(this, SoundInfo.SoundType.ONE_SHOT, !m_areSoundsOn);
        oneShotSFX.Play();
        return(oneShotSFX);
    }
Example #5
0
    /// <summary>
    /// Plays the specified sound once, and deletes the sound object after playback.
    /// </summary>
    public override void PlayOneShot(SoundInfo.SFXID soundID, Vector3 pos)
    {
        SoundObject oneShotSFX = base.PlayOneShotInternal(soundID, pos);

        oneShotSFX.transform.parent = this.transform;
        // All in-game sounds are in the second half of the SFXID enum
        if ((int)soundID >= (int)GetFirstInGameSFXID())
        {
            m_inGameSounds.Add(oneShotSFX);
        }
    }
Example #6
0
    /// <summary>
    /// Plays the specified sound.
    /// </summary>
    public override SoundObject PlaySound(SoundInfo.SFXID soundID)
    {
        SoundObject sound = base.PlaySound(soundID);

        sound.transform.parent = this.transform;
        // All in-game sounds are in the second half of the SFXID enum
        if ((int)soundID >= (int)GetFirstInGameSFXID())
        {
            m_inGameSounds.Add(sound);
        }
        return(sound);
    }
Example #7
0
 public abstract SoundObject PlaySound(SoundInfo.SFXID soundID);
Example #8
0
 public abstract void PlayOneShot(SoundInfo.SFXID soundID);
 /// <summary>
 /// Plays the specified sound once at the specified position, and deletes the sound object after playback.
 /// </summary>
 public virtual void PlayOneShot(SoundInfo.SFXID soundID, Vector3 pos)
 {
     PlayOneShotInternal(soundID, pos);
 }
 /// <summary>
 /// Creates a SoundObject for the specified SFX.
 /// </summary>
 /// <returns>The sound object.</returns>
 /// <param name="sfxID">SFX ID.</param>
 private SoundObject CreateSoundObject(SoundInfo.SFXID sfxID, bool setPersistent = false)
 {
     return(CreateSoundObject(m_sfxResources[(int)sfxID], setPersistent));
 }
Example #11
0
 /// <summary>
 /// Plays the mini game window sound.
 /// </summary>
 public void PlayMiniGameLoseSound()
 {
     SoundInfo.SFXID randomSound = (SoundInfo.SFXID)Random.Range((int)SoundInfo.SFXID.LOSE01,
                                                                 (int)SoundInfo.SFXID.LOSE03 + 1);
     PlayNewWinLoseSFX(randomSound);
 }