Exemplo n.º 1
0
 void TakeDamage(int damage)
 {
     currHealth -= damage;
     healthBar.setHealth(currHealth);
     if (currHealth == 0)
     {
         PlayerDeath();
     }
 }
Exemplo n.º 2
0
 void OnTriggerEnter2D()
 {
     //if the player invulnerability drops below 0, then the player can get hit and lose health
     if (playerInvul <= 0)
     {
         currentHealth--;
         healthBar.setHealth(currentHealth);
     }
     playerInvul = 2f;
 }
Exemplo n.º 3
0
 public void takeDamage(int Damage_value)
 {
     animator.SetTrigger("hurt");
     current_health = current_health - Damage_value;
     healthbar.setHealth((int)current_health);
     if (current_health <= 0)
     {
         die();
     }
 }
Exemplo n.º 4
0
    void TakeDamage(int damage)
    {
        currHealth -= damage;
        hb.setHealth(currHealth);

        if (currHealth <= 0)
        {
            Destroy(gameObject);
        }
    }
Exemplo n.º 5
0
 void Update()
 {
     healthbar1.setHealth(currentHealth);
     if (canStart && currentHealth != 0 && !myAnim.GetCurrentAnimatorStateInfo(0).IsTag("animation"))
     {
         transform.position += transform.forward * 3f * Time.deltaTime;
     }
     if (currentHealth == 0)
     {
         myAnim.SetBool("dying", true);
     }
 }