예제 #1
0
    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);
    }
예제 #2
0
    public float GetVolume()
    {
        float         vol     = volumn;
        FageAudioNode ancient = GetParent();

        if (ancient != null)
        {
            return(vol * ancient.GetVolume());
        }
        return(vol);
    }
예제 #3
0
    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;
        }
    }
예제 #4
0
    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;
        }
    }
예제 #5
0
    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;
        }
    }