Пример #1
0
    /// <summary>
    /// Stops a sound if it is currently playing.
    /// </summary>
    /// <param name="soundName">Name of the sound to be stopped.</param>
    public void StopSound(string soundName)
    {
        Sound s = sounds.Find(x => x.name == soundName);

        IndividualSound inds = s as IndividualSound;

        if (inds == null)
        {
            Debug.LogWarning(soundName + " individual sound not found.");
            return;
        }

        inds.Stop();
    }
Пример #2
0
    /// <summary>
    /// Checks if a sound is currently playing.
    /// </summary>
    /// <param name="soundName">Name of the sound to be checked.</param>
    /// <returns>If the specified sound is currently playing.</returns>
    public bool IsSoundPlaying(string soundName)
    {
        Sound s = sounds.Find(x => x.name == soundName);

        IndividualSound inds = s as IndividualSound;

        if (inds == null)
        {
            Debug.LogWarning(soundName + " individual sound not found.");
            return(false);
        }

        return(inds.IsPlaying());
    }