Example #1
0
    public bool canPlay(int clip_id)
    {
        SETable.Data seData = Singleton <SETable> .I.GetSeData((uint)clip_id);

        float num = 0.002f;

        if (seData != null)
        {
            num = seData.intervalLimit;
        }
        float time = Time.get_time();

        if (playingObjects.ContainsKey(clip_id))
        {
            int count = playingObjects[clip_id].Count;
            for (int i = 0; i < count; i++)
            {
                if (Mathf.Abs(playingObjects[clip_id][i].timeAtPlay - time) < num)
                {
                    return(false);
                }
            }
        }
        return(true);
    }
Example #2
0
    private void AddPlayingList(int clip_id)
    {
        SETable.Data seData = Singleton <SETable> .I.GetSeData((uint)clip_id);

        if (seData != null)
        {
            PlayingAudioList playingAudioList = new PlayingAudioList();
            playingAudioList.Setup(clip_id, seData.priority, seData.limitNum, seData.intervalLimit, seData.CullingType);
            m_dicPlayingAudio.Add(clip_id, playingAudioList);
        }
    }
Example #3
0
    private void Play(AudioClip clip, int clip_id, float volume, bool loop, AudioMixerGroup mixer_group, DisableNotifyMonoBehaviour master, Transform parent)
    {
        //IL_00b9: Unknown result type (might be due to invalid IL or missing references)
        if (master != null)
        {
            SetNotifyMaster(master);
        }
        else
        {
            ResetNotifyMaster();
        }
        clipId    = clip_id;
        PlayPhase = Phase.PREPLAY;
        if (audioSource != null)
        {
            audioSource.set_outputAudioMixerGroup(mixer_group);
            if (m_IsSpatialSound)
            {
                audioSource.set_spatialBlend(1f);
                audioSource.set_spread(360f);
            }
            else
            {
                audioSource.set_spatialBlend(0f);
                audioSource.set_spread(0f);
            }
            audioSource.set_priority(100);
            audioSource.set_rolloffMode(MonoBehaviourSingleton <SoundManager> .I.CurrentPreset.rollOffMode);
            audioSource.set_minDistance(MonoBehaviourSingleton <SoundManager> .I.CurrentPreset.minDistance);
            audioSource.set_maxDistance(MonoBehaviourSingleton <SoundManager> .I.CurrentPreset.maxDistance);
            audioSource.set_pitch(1f);
        }
        float num          = 1f;
        float dopplerLevel = 0f;

        SETable.Data seData = Singleton <SETable> .I.GetSeData((uint)clip_id);

        if (seData != null)
        {
            audioSource.set_priority((int)seData.priority);
            num          = seData.volumeScale;
            dopplerLevel = seData.dopplerLevel;
            if (seData.minDistance > 0f)
            {
                audioSource.set_minDistance(seData.minDistance);
            }
            if (seData.maxDistance > 0f)
            {
                audioSource.set_maxDistance(seData.maxDistance);
            }
            if (seData.randomPitch > 0f)
            {
                audioSource.set_pitch(GenRandomPitch());
            }
        }
        audioSource.set_dopplerLevel(dopplerLevel);
        audioSource.set_clip(clip);
        audioSource.set_loop(loop);
        audioSource.set_volume(volume * num);
        parentObject  = parent;
        needParent    = (parent != null);
        fadeoutVolume = 0f;
        TraceParent();
        audioSource.Play();
        if (m_masterGroup != null)
        {
            m_masterGroup.NotifyOnStart(this);
        }
        PlayPhase  = Phase.PLAYING;
        timeAtPlay = Time.get_time();
    }