Esempio n. 1
0
 /// <summary>
 /// Increase the volume until 0.5f (mid level)
 /// </summary>
 private void Update()
 {
     increase += Time.deltaTime / 10;
     if (increase > 0.5f)
     {
         return;
     }
     print(controller.ChangeAndPlay("sound_test_01", sound => sound.volume = increase));
 }
Esempio n. 2
0
 public void OnCollisionEnter(Collision collision)
 {
     if (!_controller)
     {
         return;
     }
     if (collision.gameObject.CompareTag("Selectable"))
     {
         float volume = Mathf.Clamp01(collision.relativeVelocity.magnitude / 10);
         _controller.ChangeAndPlay("JengaSound", sound1 =>
         {
             sound1.volume             = volume;
             sound1.transform.position = transform.position;
         });
     }
 }