AddAudioSource() public méthode

public AddAudioSource ( string name, AudioSource source ) : void
name string
source UnityEngine.AudioSource
Résultat void
Exemple #1
0
        private void PreloadResource(GameObject obj, SkillInstance instance)
        {
            m_IsResourcePreloaded = true;
            AudioManager audio_mgr = instance.CustomDatas.GetData <AudioManager>();

            if (audio_mgr == null)
            {
                audio_mgr = new AudioManager();
                instance.CustomDatas.AddData <AudioManager>(audio_mgr);
                audio_mgr.AddAudioSource(DefaultAudioName, obj.GetComponentInChildren <AudioSource>());
            }
            m_AudioSource = audio_mgr.GetAudioSource(m_Name);
            if (m_AudioSource == null)
            {
                m_AudioSource = CreateNewAudioSource(obj);
                if (m_AudioSource != null)
                {
                    audio_mgr.AddAudioSource(m_Name, m_AudioSource);
                }
                else
                {
                    m_AudioSource = obj.GetComponentInChildren <AudioSource>();
                }
            }
        }
 static public int AddAudioSource(IntPtr l)
 {
     try {
         GameFramework.Skill.Trigers.AudioManager self = (GameFramework.Skill.Trigers.AudioManager)checkSelf(l);
         System.String a1;
         checkType(l, 2, out a1);
         UnityEngine.AudioSource a2;
         checkType(l, 3, out a2);
         self.AddAudioSource(a1, a2);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 private void PreloadResource(GameObject obj, SkillInstance instance)
 {
     m_IsResourcePreloaded = true;
     AudioManager audio_mgr = instance.CustomDatas.GetData<AudioManager>();
     if (audio_mgr == null) {
         audio_mgr = new AudioManager();
         instance.CustomDatas.AddData<AudioManager>(audio_mgr);
         audio_mgr.AddAudioSource(DefaultAudioName, obj.GetComponentInChildren<AudioSource>());
     }
     m_AudioSource = audio_mgr.GetAudioSource(m_Name);
     if (m_AudioSource == null) {
         m_AudioSource = CreateNewAudioSource(obj);
         if (m_AudioSource != null) {
             audio_mgr.AddAudioSource(m_Name, m_AudioSource);
         } else {
             m_AudioSource = obj.GetComponentInChildren<AudioSource>();
         }
     }
 }