예제 #1
0
 private void OnTriggerEnter2D(Collider2D other)
 {
     if (other.GetComponent <Coche>() != null)
     {
         audioFXScript.FXSonidoChoque();
         cronometroScript.tiempo = cronometroScript.tiempo - 20;
         Destroy(this.gameObject);
     }
 }
예제 #2
0
 void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.GetComponent <Coche>() != null)
     {
         Destroy(this.gameObject);
         audioFXSCript.FXSonidoChoque();
         cronometroScript.tiempo = cronometroScript.tiempo - 20;
     }
 }
예제 #3
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.GetComponent <Coche>() != null)
     {
         audioFXScript.FXSonidoChoque();                         //Si el coche choca contra el autobús, llamamos ala función que reproduce el sonido del choque
         cronometroScript.tiempo = cronometroScript.tiempo - 20; //Si el coche choca contra el bus, le restamos 20 segundos al tiempo como penalización
         Destroy(this.gameObject);                               //Si el coche se choca con el bus, hacemos desaparecer el bus
     }
 }