void Shoot() { timer = 0f; gunAudio.Play(); gunLight.enabled = true; gunParticles.Stop(); gunParticles.Play(); gunLine.enabled = true; gunLine.SetPosition(0, transform.position); gunLine.material.color = specialWeapon ? (Color.blue) : (Color.yellow); shootRay.origin = transform.position; shootRay.direction = transform.forward; if (Physics.Raycast(shootRay, out shootHit, range, shootableMask)) { EnemyHealth enemyHealth = shootHit.collider.GetComponent <EnemyHealth> (); if (enemyHealth != null) { if (specialWeapon) { enemyHealth.Convert(); } else { enemyHealth.TakeDamage(damagePerShot, shootHit.point); // Debug.Log(shootHit.collider.gameObject.name); if (shootHit.collider.gameObject.name == "Zombear") { Debug.Log("Its a Hellephant"); } } } gunLine.SetPosition(1, shootHit.point); } else { gunLine.SetPosition(1, shootRay.origin + shootRay.direction * range); } }