Beispiel #1
0
 public void heal()
 {
     if (current_hp < MAX_HP)
     {
         if (heart_audio_prefab != null)
         {
             Instantiate(heart_audio_prefab);
         }
         HP_UI.healHeart();
         current_hp++;
     }
 }
Beispiel #2
0
 public void takeDamage(Vector3 dir, float value, int damage)
 {
     if (current_hp > 0 && !isInvincible && !hurtInvincible)
     {
         ScreenEffects.Shake();
         for (int i = 0; i < damage; i++)
         {
             HP_UI.damageHeart();
             current_hp--;
             hurtInvincible = true;
         }
         hurt      = true;
         hurtTimer = 0.1f;
         Vector2 kb_dir = new Vector2(transform.position.x - dir.x, transform.position.y - dir.y);
         rb.velocity = (kb_dir * value);
     }
 }
Beispiel #3
0
 public void takeDamage()
 {
     HP_UI.damageHeart();
     current_hp--;
 }