示例#1
0
 public void Damage(Enemy.EnemyHealth enemy)
 {
     spell.Damage(enemy);
     if (spell.isTickingDamage)
     {
         StartCoroutine(spell.DoTickingDamage(enemy));
     }
 }
示例#2
0
 public IEnumerator DoTickingDamage(Enemy.EnemyHealth enemy)
 {
     if (enemy != null)
     {
         float length = duration;
         while (length > 0)
         {
             if (enemy._currentHealth <= 0f)
             {
                 enemy.OnDeath();
             }
             enemy._currentHealth -= damage;
             Debug.Log("Enemy Health: " + enemy._currentHealth);
             length -= 1;
             enemy.healthText.text = "Health: " + enemy._currentHealth.ToString();
             yield return(new WaitForSeconds(1f));
         }
     }
 }
示例#3
0
 public void Damage(Enemy.EnemyHealth enemy)
 {
     if (enemy != null)
     {
         // Function to run when dealing damage to enemies.
         if (!isTickingDamage)
         {
             enemy._currentHealth -= damage;
         }
         else
         {
             enemy._currentHealth -= initialDamage;
         }
         if (enemy._currentHealth <= 0f)
         {
             enemy.OnDeath();
         }
         enemy.healthText.text = "Health: " + enemy._currentHealth.ToString();
         Debug.Log("Enemy Health: " + enemy._currentHealth);
     }
 }
示例#4
0
 private void Start()
 {
     _particleSystem = GetComponent <ParticleSystem>();
     _health         = GetComponent <EnemyHealth>();
 }