private IEnumerator HitEnemies() { foreach (var t in CoughtEnemies) { if (t.Value != null) { DamageMath.DamageClamp(damage, out int d, out int a); for (int i = 0; i < a; i++) { t.Value.HitMagic(Mathf.RoundToInt(d / 2.4f)); yield return(null); } } } }
private IEnumerator HitEverySecond() { while (true) { foreach (Transform t in CoughtEnemies) { EnemyProgression ep = t.GetComponentInChildren <EnemyProgression>(); if (ep != null) { DamageMath.DamageClamp(damage, out int d, out int a); for (int i = 0; i < a; i++) { ep.HitMagic(Mathf.RoundToInt(d / 2)); } } } yield return(new WaitForSeconds(0.5f)); } }
private IEnumerator DoEnemyCheck() { yield return(null); yield return(null); while (EffectReady) { RaycastHit[] hits = Physics.SphereCastAll(transform.position, Radius, Vector3.one); foreach (RaycastHit hit in hits) { if (hit.transform.CompareTag("enemyCollide")) { EnemyProgression ep = hit.transform.GetComponentInParent <EnemyProgression>(); if (ep != null) { DamageMath.DamageClamp(Damage / 2, out int dmg, out int a); if (fromEnemy) { ep._Health.Health = (int)Mathf.Clamp(ep._Health.Health + Healing / 2, 0, ep.MaxHealth); ep.Slow(6, Boost, 25); } else { for (int i = 0; i < a; i++) { ep.HitMagic(dmg); } ep.Slow(6, Slow, 10); } } } } yield return(new WaitForSeconds(0.5f)); } }