예제 #1
0
 public void Play(AudioCompositeType ptype, UnityEngine.GameObject root, params int[] audioId)
 {
     if (!m_IsInit)
     {
         this.OnInit();
     }
     if (m_NodeDic != null)
     {
         Action <UnityEngine.GameObject, int[]> func = null;
         m_NodeDic.TryGetValue(ptype, out func);
         if (func != null)
         {
             func(root, audioId);
         }
     }
 }
예제 #2
0
 public void Play(AudioCompositeType ptype, params int[] audioId)
 {
     if (!m_IsInit)
     {
         this.OnInit();
     }
     if (m_NodeDic != null)
     {
         Action <int[]> func = null;
         m_NodeDic.TryGetValue(ptype, out func);
         if (func != null)
         {
             func(audioId);
         }
     }
 }
예제 #3
0
        //创建一个音效复合节点
        public AudioCompositeBase CreateNode(AudioCompositeType stype, GameObject root = null)
        {
            //如果根节点为空则创建
            if (this.m_AudioRoot == null)
            {
                //this.Destroy();
                this.OnCreate();
            }
            AudioCompositeBase node   = null;
            List <int>         idList = null;

            if (this.m_NodeDic != null && this.m_NodeDic.Count > 0)
            {
                idList = new List <int>(this.m_NodeDic.Keys);
            }
            int node_id = AudioTools.RandomId(randomMin, randomMax, idList);

            if (root == null)
            {
                root = this.m_AudioRoot;
            }

            if (stype == AudioCompositeType.Parallel)
            {
                string name = "parallel_" + node_id;
                node = new AudioParallel(root, node_id, name);
            }
            else if (stype == AudioCompositeType.Sequence)
            {
                string name = "sequence_" + node_id;
                node = new AudioSequence(root, node_id, name);
            }
            else if (stype == AudioCompositeType.Single)
            {
                string name = "single_" + node_id;
                node = new AudioSingle(root, node_id, name);
            }
            this.AddNode(node_id, node);
            return(node);
        }