IEnumerator shooting() { RaycastHit hit; if (Physics.Raycast(cam.transform.position, cam.transform.forward, out hit, range, layer)) { //Debug.Log(hit.transform.name); // Debug.DrawRay(cam.transform.position,cam.transform.forward,Color.green,2f); enemyHealth health = hit.collider.GetComponent <enemyHealth>(); collisionD destruction = hit.collider.GetComponent <collisionD>(); if (health != null) { clock.enabled = true; clock.gameObject.SetActive(true); clock.starter(); yield return(new WaitForSeconds(1f)); health.damageHit(damageDone); } time1 = clock.timer; clock.changer(1); clock.enabled = false; clock.gameObject.SetActive(false); if (destruction != null) { destruction.killiingItem(true); } } }