public IEnumerator StopDigAfterCooldown() { float endTime = Time.time + _digDuration; // Only stop digging if the duration is over, the character is no longer on the ground and it has to have enough space to regrow while ((Time.time < endTime && _onGround) || !_canFitHoleBody) { yield return(null); } _animator.SetBool(AnimatorParameter.DIG, false); // If the KujangaBoss is active we need to stop ignoring collisions with it when we stop digging GameObject kujengaBoss = GameObject.Find("KujengaBoss"); if (kujengaBoss != null && kujengaBoss.GetComponent <KujengaBossController>().StartedBossFight) { Physics2D.IgnoreCollision(GameObject.Find("KujengaBoss").GetComponent <CapsuleCollider2D>(), _capsuleCollider2D, false); } ResizeColliderToNormal(); CanJump = true; _isDigging = false; _attackController.Resume(); }