void Shoot() { shootTimer = 0f; gunLine.enabled = true; gunAudio.Play(); gunLine.SetPosition(0, shootingPoint.position); shootRay.origin = shootingPoint.position; shootRay.direction = transform.forward; if (Physics.Raycast(shootRay, out shootHit, range, shootableMask)) { NormalAgentGame normalAgentGame = shootHit.collider.GetComponent <NormalAgentGame>(); PlayerHealth playerHealth = shootHit.collider.GetComponent <PlayerHealth>(); if (normalAgentGame != null) { //Debug.Log("Hit!"); //AddReward(0.33f); if (isCheating) { damagePerShot = cheatDamagePerShot; } normalAgentGame.TakeDamage(damagePerShot, this); // Harming other agents } else if (playerHealth != null) { if (isCheating) { damagePerShot = cheatDamagePerShot; } playerHealth.TakeDamage(damagePerShot, this); // Harming player } else { //Debug.Log("Missed!"); //AddReward(-0.1f); } gunLine.SetPosition(1, shootHit.point); } else { gunLine.SetPosition(1, shootRay.origin + shootRay.direction * range); //Debug.Log("Missed!"); } }