private void Shoot() { if (!tc.hasShot) { tc.hasShot = true; lr = tc.currentPlayer.gameObject.GetComponent <LineRenderer>(); lr.SetPosition(0, tc.currentPlayer.transform.position); if (Physics.Raycast(transform.position, transform.TransformDirection(Vector3.forward), out hit, reach)) { lr.SetPosition(1, hit.transform.position); } else { lr.SetPosition(1, endRay.position); } if (!lr.enabled) { lr.enabled = true; } if (Physics.Raycast(transform.position, transform.TransformDirection(Vector3.forward), out hit, reach)) { if (hit.transform.gameObject.tag == enemyTag) { if (tc.currentPlayer != null) { // Hit enemy Debug.Log("Enemy Hit"); // hit.transform.gameObject.GetComponent<FirstPersonController>(); GameObject enemy = tc.GetOtherPlayer().gameObject; enemy.GetComponent <HealthManager>().TakeDamage(); } } } } }