public void Shoot() { _flash.Play(); _audio.Play(); RaycastHit hit; Vector3 dir = new Vector3(_flash.transform.forward.x, _flash.transform.forward.y - 0.01f, _flash.transform.forward.z); if (Physics.Raycast(_flash.transform.position, dir, out hit, 200f)) { GameObject impact = Instantiate(_impact, hit.point, Quaternion.LookRotation(hit.normal)); Destroy(impact, 0.1f); HP hp = hit.transform.GetComponent <HP>(); Armour armour = hit.transform.GetComponent <Armour>(); if (armour != null && armour.enabled) { armour.GetDamage(_damage); return; } if (hp != null && hit.transform.tag != transform.tag) { hp.GetDamage(_damage); } } }