Пример #1
0
 public void Hurt(int damage, Vector2 force, string source)
 {
     if (avoidDamage)
     {
         return;
     }
     if (source.Equals(GameManager.GroundTrap) && property.HaveEquipment("Helmet"))
     {
         return;
     }
     if (source.Equals(GameManager.FlyingTrap) && property.HaveEquipment("SubmarineHelmet"))
     {
         return;
     }
     property.Hurt(damage);
     UIManager.GetInstance().Hurt();
     Camera.main.GetComponent <CameraController>().Shake();
     if (!property.isDead)
     {
         isHurting = true;
         anim.Hurt();
         canMove         = true;
         rb.bodyType     = RigidbodyType2D.Dynamic;
         rb.gravityScale = 1f;
         rb.velocity     = new Vector2(0, 0);
         rb.AddForce(force, ForceMode2D.Impulse);
         avoidDamage = true;
         StartCoroutine(Recover());
     }
 }