Пример #1
0
    void OnTriggerEnter(Collider collider)
    {
        if (collider.gameObject.CompareTag("ground"))
        {
            audioSource.clip = ground;
            _normal          = Mathf.Abs(rig.velocity.y);

            _soundLevel = Mathf.Lerp(-30f, 0.5f, _normal / smothing);

            //_soundLevel += 60f;
            //Debug.LogFormat("{0}v at {1} sound",rig.velocity.y,_soundLevel);
            mixer.SetFloat("sfxVol", _soundLevel);
            //mixer.SetFloat ("EffectVolume", -19.14f);
            audioSource.Play();
        }
        if (collider.gameObject.CompareTag("hoop") && rig.velocity.y < 0 && !OneTime)
        {
            OneTime          = false;
            audioSource.clip = hoop;

            //GameManager.Instatance().UpdateScore();


            _normal = Mathf.Abs(rig.velocity.y);

            _soundLevel = Mathf.Lerp(-30f, 0.5f, _normal / smothing);

            //_soundLevel += 60f;
            //Debug.LogFormat("{0}v at {1} sound",rig.velocity.y,_soundLevel);
            mixer.SetFloat("sfxVol", _soundLevel);
            audioSource.Play();
        }
        if (collider.gameObject.CompareTag("spike"))
        {
            audioSource.clip = explode;
            audioSource.Play();

            explodeBall.ExplodeBall();
        }

        //Debug.Log ("sound");
    }