public virtual IEnumerator DidPunch() { this.anim.CrossFadeQueued("punch", 0.1f, QueueMode.PlayNow); yield return(new WaitForSeconds(this.punchHitTime)); Vector3 pos = this.transform.TransformPoint(this.punchPosition); GameObject[] enemies = GameObject.FindGameObjectsWithTag("Enemy"); foreach (GameObject go in enemies) { EnemyDamage enemy = (EnemyDamage)go.GetComponent(typeof(EnemyDamage)); if (enemy == null) { continue; } if (Vector3.Distance(enemy.transform.position, pos) < this.punchRadius) { enemy.SendMessage("ApplyDamage", this.punchHitPoints); if (this.punchSound) { this.GetComponent <AudioSource>().PlayOneShot(this.punchSound); } } } yield return(new WaitForSeconds(this.punchTime - this.punchHitTime)); this.busy = false; }