Beispiel #1
0
 private void OnTriggerEnter2D(Collider2D other)
 {
     if (other.gameObject.CompareTag("Nivel"))
     {
         LoadNextLevel();
     }
     if (other.gameObject.CompareTag("Coins"))
     {
         Destroy(other.gameObject);
         _audioSource.PlayOneShot(AudioCoins);
         Puntaje.AddPoints(1);
     }
     if (other.gameObject.CompareTag("Enemy"))
     {
         if (Vida.GetVida())
         {
             Vida.RemoveLife(1);
         }
         else
         {
             Vida.GetVida();
             Debug.Log("Estas muerto");//muerte = true;
         }
     }
 }
 private void OnCollisionEnter2D(Collision2D collision)
 {
     if (collision.gameObject.tag == "Enemigo")
     {
         Destroy(collision.gameObject);
         Destroy(this.gameObject);
         Puntaje.AddPoints(10);
         Debug.Log(Puntaje.GetPoint());
     }
 }
Beispiel #3
0
 private void OnCollisionEnter2D(Collision2D collision)
 {
     if (collision.gameObject.tag == "Obstaculo" || collision.gameObject.tag == "Enemigo")
     {
         muerte = true;
     }
     if (collision.gameObject.tag == "Coins")
     {
         coins = true;
         Destroy(collision.gameObject);
         _audioSource.PlayOneShot(AudioCoins);
         Puntaje.AddPoints(5);
         Debug.Log(Puntaje.GetPoint());
     }
 }