void Shoot() { muzzleFlash.Play(); //show muzzle flash RaycastHit hit; if (Physics.Raycast(fpsCam.transform.position, fpsCam.transform.forward, out hit, range)) { if (hit.collider.tag == "Enemy") { DestructableObject DO = hit.collider.gameObject.GetComponent <DestructableObject>(); if (DO != null) { DO.TakeDamage(damage); Debug.Log("Hit Enemy: " + DO.health + " Hp"); } } } }