/** * This method is called when the user presses the fire button. */ void Shoot() { // print("Shoot method"); DoShootEffect(); // The player is currently shooting, call the shoot method on the server. //CmdOnShoot(); // Using a raycast to see what the player is aiming at, and then shooting to that place. RaycastHit hit; if (Physics.Raycast(cam.transform.position + cam.transform.forward * 35.0f, cam.transform.forward, out hit, currentWeapon.range, mask)) { Debug.Log("We hit - " + hit.collider.tag); if (hit.collider.tag == "Boot1") { //GameObject target = hit.collider.gameObject; SinglePlayerBootController boot1 = hit.collider.gameObject.GetComponent <SinglePlayerBootController> (); boot1.TakeDamage(currentWeapon.damage, PLAYER_TAG); } if (hit.collider.tag == "Boot2") { //GameObject target = hit.collider.gameObject; SinglePlayerBootController boot2 = hit.collider.gameObject.GetComponent <SinglePlayerBootController> (); boot2.TakeDamage(currentWeapon.damage, PLAYER_TAG); } if (hit.collider.tag == "Boot3") { //GameObject target = hit.collider.gameObject; SinglePlayerBootController boot3 = hit.collider.gameObject.GetComponent <SinglePlayerBootController> (); boot3.TakeDamage(currentWeapon.damage, PLAYER_TAG); } } }
void Start() { spline = patrolPath; duration = spline.CalculateDuration(speed); progress = 0; currentPosition = GetCurrentPosition(); singlePlayerBoot1Controller = GetComponent <SinglePlayerBootController> (); }