void WeaponFiredHandler() { if (isReloading) { return; } shootAudioSource.clip = firingSound; if (isADS) { anim.Play("Aim Fire", 0, 0f); } else { muzzleFlash.Play(); anim.Play("Fire", 0, 0f); } shootAudioSource.Play(); rifleCurrentAmmo--; RaycastHit hit; if (Physics.Raycast(playerCam.transform.position, playerCam.transform.forward, out hit, Mathf.Infinity, ~(1 << 13))) { GameObject impactGameObject = Instantiate(impactEffect, hit.point, Quaternion.LookRotation(hit.normal)); Destroy(impactGameObject, 0.5f); Targetable target = hit.transform.GetComponent <Targetable>(); if (target != null) { target.isHit(); } } }