private void HandleMeleeWeaponAttack(GameObject weapon, bool enable) { if (weapon == null) { return; } BaseWeapon weaponScript = weapon.GetComponent <BaseWeapon> (); if (weaponScript == null || weaponScript.WeaponType != BaseWeapon.MELEE) { return; } MeleeWeapon meleeWeaponScript = weapon.GetComponent <MeleeWeapon> (); //check if the weapons should be enabled or disabeled if (enable) { meleeWeaponScript.EnableHitZone(); } else { meleeWeaponScript.DisableHitZone(); } }