void Shoot() { muzzleFLash.Play(); ak47.Play(); currentAmmo--; ammoTest.ammo = currentAmmo; Vector3 point = new Vector3(playerCam.pixelWidth / 2, playerCam.pixelHeight / 2, 0); Ray ray = playerCam.ScreenPointToRay(point); RaycastHit hit; if (Physics.Raycast(ray, out hit)) { GameObject hitObject = hit.transform.gameObject; EnemyShot target = hitObject.GetComponent <EnemyShot>(); if (target != null) { target.GotShot(damage); GameObject enemyBlood = Instantiate(enemyHitEffect, hit.point, Quaternion.LookRotation(hit.normal)); Destroy(enemyBlood, 2f); } else { GameObject impact = Instantiate(impactEffect, hit.point, Quaternion.LookRotation(hit.normal)); Destroy(impact, 2f); } } }