public void TakeDamage(int damage)
 {
     currenthealth -= damage;
     healthbar.SetHealth(currenthealth);
     if (currenthealth <= 0)
     {
         Die();
     }
 }
Esempio n. 2
0
 public void Hurt(bool right)// ajouter un int pour differencier le nombre de dégats infligés ?
 {
     health--;
     if (health <= 0)
     {
         IsDead();
     }
     else
     {
         Isknocked(right);
         healthba.SetHealth(health);
     }
 }
Esempio n. 3
0
 void TakeDamage(int damage)
 {
     currentHealth -= damage;
     healthBar.SetHealth(currentHealth);
     if (currentHealth <= 0)
     {
         anim.SetBool("isDead", true);
         //Destroy(gameObject, 2f);
         //Destroy(player.transform.Find("Gun").gameObject);
         playcont.enabled = false;
         Destroy(gun);
         //Destroy(player);
         gameManager.GameOver();
     }
 }
Esempio n. 4
0
 public void TakeDamage(int damage)
 {
     FindObjectOfType <AudioManager>().Play("Enemy_gethit");
     health -= damage;
     healthbar.SetHealth(health);
     if (health <= 0)
     {
         Die();
     }
 }
    public void TakeDamage(int damage)
    {
        if (blocking)
        {
            damage = 0;
            Debug.Log("Opponent is blocking! no damage taken!"); //When the enemy takes damage, it will be neglected if the opponent is blocking. I can change this in case of having chip damage
        }
        currentHealth -= damage;                                 //If the opponent is not blocking, damage is taken to the current health and the slider is set at a new value

        hpb.SetHealth(currentHealth);

        if (currentHealth <= 0) //if the enemy healthbar is 0 or below they die.
        {
            Die();
        }
    }
Esempio n. 6
0
 void RPC_TakeDamage(float amount, string uid)
 {
     if (!SelfPV.IsMine)
     {
         return;
     }
     if (currentHealth >= 0f)
     {
         currentHealth -= amount;
         hp.SetHealth(currentHealth);
         if (currentHealth <= 0f && !DeathAnimation)
         {
             DeathAnimation    = true;
             GameUI.GamePaused = true;
             ani.SetBool("dying", true);
             ani.SetLayerWeight(2, 1f);
             StartCoroutine(Die(uid));
             DeathAnimation = false;
             // Invoke("Die", 5f);
         }
     }
 }
Esempio n. 7
0
 void TakeDamage(int damage)
 {
     currentHealth -= damage;
     healthBar.SetHealth(currentHealth);
 }