Ejemplo n.º 1
0
 void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.tag == "Health Bonus")
     {
         collision.GetComponent <Bonus>().PickUp();
         if (health <= maxHealth - 50f)
         {
             health += 50f;
         }
     }
     else if (collision.tag == "PowerUp Bonus")
     {
         collision.GetComponent <Bonus>().PickUp();
         gameSession.AddSuperAmmo();
     }
     else if (collision.tag == "Shield Bonus")
     {
         collision.GetComponent <Bonus>().PickUp();
         gameSession.AddShield();
     }
     else
     {
         DamageDealer damageDealer = collision.GetComponent <DamageDealer>();
         if (!damageDealer)
         {
             return;
         }
         ProcessHit(damageDealer, (collision.tag == "Boss"));
     }
 }