void Shoot() { shootSound.Play(); muzzleFlash.Play(); RaycastHit hit; if (Physics.Raycast(Cam.transform.position, Cam.transform.forward, out hit)) { Debug.Log(hit.transform.name); EnemyDamage enemy = hit.transform.GetComponent <EnemyDamage>(); if (enemy != null) { enemy.Die(); } } }