Esempio n. 1
0
 private void Cooldown()
 {
     timer -= Time.deltaTime;
     if (timer <= 0 && attackMode)
     {
         DragonSounds.PlaySounds("attack");
         Instantiate(Fire, transform.position, Quaternion.identity);
         cooling = false;
         timer   = intTimer;
     }
 }
Esempio n. 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;
     }
 }
Esempio n. 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();
        }
    }