Exemplo n.º 1
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.tag == "Player")
     {
         playerHealth playerFell = collision.GetComponent <playerHealth>();
         playerFell.makeDead();
     }
     else if (collision.tag == "Enemy")
     {
         enemyHealth enemyFell = collision.GetComponent <enemyHealth>();
         enemyFell.makeDead();
     }
 }
Exemplo n.º 2
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.tag == "Player")
     {
         playerHealth player = other.GetComponent <playerHealth>();
         player.makeDead();
         player.healthSlider.value = 0;
         Time.timeScale            = 0f;
     }
     else
     {
         enemyHealth enemy = other.GetComponent <enemyHealth>();
         enemy.makeDead();
     }
 }