Exemplo n.º 1
0
 private void OnCollisionEnter2D(Collision2D collision)
 {
     if (collision.collider.CompareTag("Damage") && collision.otherCollider.CompareTag("Player"))
     {
         Shot shot = collision.collider.GetComponent <Shot>();
         if (!shot.hasHit)
         {
             shot.hasHit = true;
             if (hearts.BreakHeart())
             {
                 GameObject brokenClone = Instantiate(playerBroken, null);
                 brokenClone.transform.position = transform.position;
                 Destroy(brokenClone, 3f);
                 DisablePlayer();
                 gameManager.ResetLevelAfterSeconds();
             }
         }
     }
 }