public static void SetFPCam() { SpecCam.mode = 1; GameObject gameObject = GameObject.Find("WeaponCamera"); gameObject.GetComponent <Camera>().cullingMask = -2147483648; SpecCam.FindPlayer(); if (SpecCam.FID < 0) { SpecCam.mode = 0; gameObject.GetComponent <Camera>().cullingMask = 0; } }
private static void FPCam() { if (Input.GetKeyUp(KeyCode.Mouse0)) { SpecCam.FindPlayer(); } if (SpecCam.FID >= 0) { if (PlayerControll.Player[SpecCam.FID] == null) { SpecCam.FID = -1; } else if (PlayerControll.Player[SpecCam.FID].go == null) { SpecCam.FID = -1; } } if (SpecCam.FID < 0) { SpecCam.FindPlayer(); if (SpecCam.FID < 0) { SpecCam.mode = 0; GameObject gameObject = GameObject.Find("WeaponCamera"); gameObject.GetComponent <Camera>().cullingMask = 0; } return; } float num = PlayerControll.Player[SpecCam.FID].rotation.x; if (num >= 270f && num <= 360f) { num = 360f - num; } else if (num >= 0f && num <= 90f) { num = 0f - num; } float num2 = SpecCam.rr.x; if (num2 >= 270f && num2 <= 360f) { num2 = 360f - num2; } else if (num2 >= 0f && num2 <= 90f) { num2 = 0f - num2; } float num3 = PlayerControll.Player[SpecCam.FID].rotation.y; float num4 = SpecCam.rr.y - PlayerControll.Player[SpecCam.FID].rotation.y; if (num4 > 180f) { num3 += 360f; } if (num4 < -180f) { num3 -= 360f; } SpecCam.rr = Vector3.Lerp(new Vector3(num2, SpecCam.rr.y, SpecCam.rr.z), new Vector3(num, num3, PlayerControll.Player[SpecCam.FID].rotation.z), Time.deltaTime * 5f); if (SpecCam.rr.x <= 0f) { SpecCam.rr.x = SpecCam.rr.x * -1f; } else { SpecCam.rr.x = 360f - SpecCam.rr.x; } Camera.main.transform.eulerAngles = SpecCam.rr; Crosshair.SetOffsetNull(); }