Exemplo n.º 1
0
 private void LateUpdate()
 {
     if (needParent)
     {
         if (parentObject != null)
         {
             TraceParent();
         }
         else if (audioSource.get_loop())
         {
             Stop(0);
             needParent = false;
         }
     }
     if (fadeoutVolume > 0f)
     {
         audioSource.set_volume(Mathf.Max(audioSource.get_volume() - fadeoutVolume, 0f));
         if (audioSource.get_volume() == 0f)
         {
             StopImmidiate();
         }
     }
     if (!audioSource.get_isPlaying())
     {
         if (m_masterGroup != null)
         {
             m_masterGroup.NotifyOnStop(this);
             m_masterGroup = null;
         }
         Dispose();
     }
 }
Exemplo n.º 2
0
    public static void StopVoice(uint ch_id = 0, int fadeout_frame = 2)
    {
        AudioControlGroup audioControlVoice = MonoBehaviourSingleton <SoundManager> .I.GetAudioControlVoice(ch_id);

        if (!(audioControlVoice == null))
        {
            audioControlVoice.StopAll(fadeout_frame);
        }
    }
Exemplo n.º 3
0
    public static AudioControlGroup Create(CullingTypes type = CullingTypes.NONE, int LimitNum = int.MaxValue)
    {
        //IL_0005: Unknown result type (might be due to invalid IL or missing references)
        //IL_000a: Expected O, but got Unknown
        GameObject        val = new GameObject("AudioControlGroup");
        AudioControlGroup audioControlGroup = val.AddComponent <AudioControlGroup>();

        audioControlGroup._transform.set_parent(MonoBehaviourSingleton <SoundManager> .I._transform);
        audioControlGroup.Setup(type, LimitNum);
        return(audioControlGroup);
    }
Exemplo n.º 4
0
 private void StopImmidiate()
 {
     if (!(audioSource == null) && PlayPhase != 0 && PlayPhase != Phase.STOP)
     {
         audioSource.Stop();
         if (m_masterGroup != null)
         {
             m_masterGroup.NotifyOnStop(this);
             m_masterGroup = null;
         }
         PlayPhase = Phase.STOP;
     }
 }
Exemplo n.º 5
0
 private void Dispose()
 {
     InitParams();
     if (audioSource != null)
     {
         audioSource.Stop();
         InitAudioSource();
     }
     if (m_masterGroup != null)
     {
         m_masterGroup.NotifyOnStop(this);
         m_masterGroup = null;
     }
     AudioObjectPool.Release(this);
 }
Exemplo n.º 6
0
 public void Stop(int fadeout_framecount = 0)
 {
     if (!(audioSource == null) && !(fadeoutVolume > 0f))
     {
         if (fadeout_framecount < 4)
         {
             fadeout_framecount = 4;
         }
         fadeoutVolume = audioSource.get_volume() / (float)fadeout_framecount;
         if (m_masterGroup != null)
         {
             m_masterGroup.NotifyOnRelease(this);
             m_masterGroup = null;
         }
         PlayPhase = Phase.PRESTOP;
     }
 }
Exemplo n.º 7
0
    public static void PlayVoice(AudioClip audio_clip, int voice_id, float volume = 1f, uint ch_id = 0, DisableNotifyMonoBehaviour master = null, Transform parent = null)
    {
        if (GameSaveData.instance.voiceOption != 2 && MonoBehaviourSingleton <SoundManager> .IsValid() && !(audio_clip == null))
        {
            float num = volume * MonoBehaviourSingleton <SoundManager> .I.volumeVOICE;
            if (!(num < 0.05f))
            {
                bool is3DSound = (!(parent == null)) ? true : false;
                AudioControlGroup audioControlVoice = MonoBehaviourSingleton <SoundManager> .I.GetAudioControlVoice(ch_id);

                if (!(audioControlVoice == null))
                {
                    audioControlVoice.CreateAudio(audio_clip, voice_id, num, false, MonoBehaviourSingleton <SoundManager> .I.mixerGroupVoice, is3DSound, master, parent, null);
                }
            }
        }
    }
Exemplo n.º 8
0
 public void SetupAudioControlGroup()
 {
     if (audioControlSESelf == null)
     {
         audioControlSESelf = AudioControlGroup.Create(AudioControlGroup.CullingTypes.NONE, 2147483647);
     }
     if (audioControlJingle == null)
     {
         audioControlJingle = AudioControlGroup.Create(AudioControlGroup.CullingTypes.NONE, 2147483647);
     }
     if (audioControllVoice == null)
     {
         audioControllVoice = new AudioControlGroup[6];
         for (int i = 0; (long)i < 6L; i++)
         {
             audioControllVoice[i] = AudioControlGroup.Create(AudioControlGroup.CullingTypes.OVERWRITE, 1);
         }
     }
 }
Exemplo n.º 9
0
    public static AudioObject Create(AudioClip clip, int clip_id, float volume, bool loop, AudioMixerGroup mixer_group, AudioControlGroup controlGroup, bool is3DSound = false, DisableNotifyMonoBehaviour master = null, Transform parent = null, Vector3?initPos = default(Vector3?))
    {
        //IL_0065: Unknown result type (might be due to invalid IL or missing references)
        //IL_006f: Unknown result type (might be due to invalid IL or missing references)
        if (clip == null)
        {
            return(null);
        }
        AudioObject audioObject = AudioObjectPool.Borrow();

        if (!(audioObject == null))
        {
            goto IL_0020;
        }
        goto IL_0020;
IL_0020:
        audioObject._transform.set_parent(MonoBehaviourSingleton <SoundManager> .I._transform);
        audioObject.m_masterGroup    = controlGroup;
        audioObject.m_IsSpatialSound = is3DSound;
        if (initPos.HasValue)
        {
            audioObject._transform.set_position((!initPos.HasValue) ? Vector3.get_zero() : initPos.Value);
            audioObject.m_IsStaticPosition = true;
        }
        audioObject.Play(clip, clip_id, volume, loop, mixer_group, master, parent);
        return(audioObject);
    }