예제 #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>();
 }