private void OnTriggerEnter(Collider other) { if (other.CompareTag("Player")) { if (!isAttacking) { ai.Attack(timeBetweenAttacks, true, attackAnimation.length); isAttacking = true; attackCoroutine = Attack(other.GetComponent <Player>()); StartCoroutine(attackCoroutine); } } }