public void Attack() { if (!isEquipped) { return; } if (canAttack) { canAttack = false; isAttacking = true; timer = 0; cooldown = attackPeriod; audio.Play(); Collider2D[] results = new Collider2D[255]; if (isMelee) { int count = Physics2D.OverlapCollider(GetComponent <Collider2D>(), filter, results); results.All(col => { DealDamageMelee(col); return(true); }); } } else { Debug.Log("Weapon is on cooldown! Remain time = " + cooldown); } }