Exemplo n.º 1
0
 void OnTriggerEnter(Collider col)
 {
     if (col.gameObject.tag == "Espada")
     {
         float damage = col.gameObject.GetComponentInParent <PlayerBehaviour>().GetDamage();
         PopUpHitPoint.ShowMessage("-" + damage, transform.position);
         life -= damage;
     }
 }
Exemplo n.º 2
0
 public void TakeDamage(float damage)
 {
     if (life > 0)
     {
         anim.SetTrigger("hit");
         life -= damage;
         if (life <= 0)
         {
             Timer._timer.plustime(life + damage);
             PopUpHitPoint.ShowMessage("+" + (life + damage), transform.position);
             StartCoroutine(death());
         }
         else
         {
             Timer._timer.plustime(damage);
             PopUpHitPoint.ShowMessage("+" + damage, transform.position);
         }
     }
     else
     {
         StartCoroutine(death());
     }
 }