private void AddNode(int id, AudioCompositeBase audioCompositeBase) { if (audioCompositeBase != null && m_NodeDic != null) { m_NodeDic[id] = audioCompositeBase; } }
public void StopAll() { if (this.m_ParallelNode != null) { this.m_ParallelNode.Stop(); this.m_ParallelNode = null; } }
private void PlayParallel(UnityEngine.GameObject root, params int[] audioId) { if (this.m_ParallelNode == null) { var node = AudioManager.Instance.CreateNode(AudioCompositeType.Parallel); this.m_ParallelNode = node; } if (this.m_ParallelNode != null) { this.m_ParallelNode.Play(root, audioId); } }
private void PlaySingle(params int[] audioId) { if (this.m_SingleNode == null) { var node = AudioManager.Instance.CreateNode(AudioCompositeType.Single); this.m_SingleNode = node; } if (this.m_SingleNode != null) { this.m_SingleNode.Play(audioId); } }
public void StopAll() { if (this.m_ParallelNode != null) { this.m_ParallelNode.Stop(); this.m_ParallelNode = null; } if (this.m_SequenceNode != null) { this.m_SequenceNode.Stop(); this.m_SequenceNode = null; } if (this.m_SingleNode != null) { this.m_SingleNode.Stop(); this.m_SingleNode = null; } }
//创建一个音效复合节点 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); }