Пример #1
0
 private void Cooldown()
 {
     timer -= Time.deltaTime;
     if (timer <= 0 && attackMode)
     {
         DemonSounds.PlaySounds("attack");
         cooling = false;
         timer   = intTimer;
     }
 }
Пример #2
0
 private void Die()
 {
     if (typeEnemy == "Demon")
     {
         DemonSounds.PlaySounds("die");
         GetComponent <BoxCollider2D>().enabled = false;
         GetComponent <AIEnemy>().enabled       = false;
         anim.SetBool("Dead", true);
         this.enabled = false;
     }
     if (typeEnemy == "Dragon")
     {
         DragonSounds.PlaySounds("die");
         GetComponent <BoxCollider2D>().enabled = false;
         GetComponent <Dragon_AI>().enabled     = false;
         anim.SetBool("DragonDead", true);
         this.enabled = false;
     }
 }
Пример #3
0
    public void TakeDamage(int damage)
    {
        if (typeEnemy == "Demon")
        {
            DemonSounds.PlaySounds("hurt");
            currentHealth -= damage;
            anim.SetTrigger("Hurt");
        }
        if (typeEnemy == "Dragon")
        {
            DragonSounds.PlaySounds("hurt");
            currentHealth -= damage;
            anim.SetTrigger("DragonHurt");
        }

        if (currentHealth <= 0)
        {
            coins        += 10;
            enemyRemains -= 1;
            PlayerPrefs.SetInt("Scores", enemyRemains);
            Die();
        }
    }