IEnumerator HitManagement(int h) { _normalHits = h; SpecialEffectsManager SpecialEffect; foreach (var item in SpecialEffects_Pools) { if (!item.gameObject.activeInHierarchy) { SpecialEffect = item.GetComponent <SpecialEffectsManager>(); if (SpecialEffect.SpecialEffectsCode == 2) { Vector3 _playerPos = MainPlayer.transform.position; float _dice = Random.Range(-0.35f, 0.35f); Vector3 Pos = new Vector3(_playerPos.x + _dice, _playerPos.y + _dice, _playerPos.z + _dice); SpecialEffect.OnEndPlayingSpecialEffects(Pos); break; } } } yield return(new WaitForSeconds(0.25f)); if (_normalHits > 0) { _normalHits -= 1; MainPlayer.GetComponent <PlayerManager>().OnTakenDamage(1); StartCoroutine(HitManagement(_normalHits)); } else { } }