void Shoot() { muzzle.Play(); currentAmmo -= 1; RaycastHit hit; if (Physics.Raycast(fpsCam.transform.position, fpsCam.transform.forward, out hit, range)) { //Debug.Log(hit.transform.name); HitEnemy hitEnemy = hit.transform.GetComponent <HitEnemy>(); if (hitEnemy != null) { if (hit.transform.name.Equals("HeadHitMarker")) { hitEnemy.Damage(headDamage); } else { hitEnemy.Damage(torsoArmDamage); } GameObject go1 = Instantiate(enemyHit, hit.point, Quaternion.LookRotation(hit.normal)); Destroy(go1, 2f); } else { GameObject go2 = Instantiate(impact, hit.point, Quaternion.LookRotation(hit.normal)); Destroy(go2, 2f); } } }