public void Play(string nodeId, string resourcePath, bool loop = false) { FageAudioNode node = FageAudioNode.Find(nodeId); FageAudioSourceControl audioSourceControl = (_hashtable[node] as FageAudioPooler).GetFreeAudioSourceControl(); audioSourceControl.Play(CachedResource.Load <AudioClip>(resourcePath), loop, node.GetVolume(), false); }
public float GetVolume() { float vol = volumn; FageAudioNode ancient = GetParent(); if (ancient != null) { return(vol * ancient.GetVolume()); } return(vol); }
public void SetVolume(string nodeId, float volume) { FageAudioNode node = FageAudioNode.Find(nodeId); node.volumn = Mathf.Clamp(volume, 0f, 1f); float globalVolume = node.GetVolume(); FageAudioSourceControl[] controls = (_hashtable[node] as FageAudioPooler).GetAudioSourceControls(); foreach (FageAudioSourceControl control in controls) { control.volume = globalVolume; } }
public FageAudioPooler(FageAudioNode node, GameObject listener) { _node = node; _index = 0; _controls = new FageAudioSourceControl[node.channels]; for (int i = 1; i <= _node.channels; i++) { GameObject child = new GameObject (node.name + " " + i.ToString (), typeof(AudioSource), typeof(FageAudioSourceControl)); child.transform.SetParent (listener.transform); FageAudioSourceControl control = child.GetComponent<FageAudioSourceControl>(); control.enabled = false; _controls[i - 1] = control; } }
public FageAudioPooler(FageAudioNode node, GameObject listener) { _node = node; _index = 0; _controls = new FageAudioSourceControl[node.channels]; for (int i = 1; i <= _node.channels; i++) { GameObject child = new GameObject(node.name + " " + i.ToString(), typeof(AudioSource), typeof(FageAudioSourceControl)); child.transform.SetParent(listener.transform); FageAudioSourceControl control = child.GetComponent <FageAudioSourceControl>(); control.enabled = false; _controls[i - 1] = control; } }