IEnumerator _attack(FriendlyNetwork fn) { be.Explode(); var hits = Random.Range(3, 6); var dmg = damage / hits; GetComponent <Collider2D>().enabled = false; for (int i = 0; i < hits; i++) { fn.Damage(Random.Range(0f, 1f) > 0.9f ? dmg * 1.5f : dmg); yield return(new WaitForSeconds(0.045f)); } yield return(new WaitForEndOfFrame()); Destroy(gameObject); }
public void Attack(FriendlyNetwork fn) { StartCoroutine(_attack(fn)); }