| using System; |
| using System; |
| using System.IO; |
| using System.IO; |
| using System.Runtime.CompilerServices; |
| using System.Runtime.CompilerServices; |
| using UnityEngine; |
| using UnityEngine; |
| using Valheim.UI; |
| using Valheim.UI; |
| |
| |
| public class GameCamera : MonoBehaviour |
| public class GameCamera : MonoBehaviour |
| { |
| { |
| public static GameCamera instance |
| public static GameCamera instance |
| { |
| { |
| get |
| get |
| { |
| { |
| return GameCamera.m_instance; |
| return GameCamera.m_instance; |
| } |
| } |
| } |
| } |
| |
| |
| private void Awake() |
| private void Awake() |
| { |
| { |
| GameCamera.m_instance = this; |
| GameCamera.m_instance = this; |
| this.m_camera = base.GetComponent<Camera>(); |
| this.m_camera = base.GetComponent<Camera>(); |
| this.m_listner = base.GetComponentInChildren<AudioListener>(); |
| this.m_listner = base.GetComponentInChildren<AudioListener>(); |
| . | |
| this.m_heatDistortImageEffect = base.GetComponent<HeatDistortImageEffect>(); |
| this.m_camera.depthTextureMode = DepthTextureMode.DepthNormals; |
| this.m_camera.depthTextureMode = DepthTextureMode.DepthNormals; |
| this.ApplySettings(); |
| this.ApplySettings(); |
| if (!Application.isEditor) |
| if (!Application.isEditor) |
| { |
| { |
| this.m_mouseCapture = true; |
| this.m_mouseCapture = true; |
| } |
| } |
| } |
| } |
| |
| |
| private void OnDestroy() |
| private void OnDestroy() |
| { |
| { |
| if (GameCamera.m_instance == this) |
| if (GameCamera.m_instance == this) |
| { |
| { |
| GameCamera.m_instance = null; |
| GameCamera.m_instance = null; |
| } |
| } |
| } |
| } |
| |
| |
| public void ApplySettings() |
| public void ApplySettings() |
| { |
| { |
| this.m_cameraShakeEnabled = PlayerPrefs.GetInt("CameraShake", 1) == 1; |
| this.m_cameraShakeEnabled = PlayerPrefs.GetInt("CameraShake", 1) == 1; |
| this.m_shipCameraTilt = PlayerPrefs.GetInt("ShipCameraTilt", 1) == 1; |
| this.m_shipCameraTilt = PlayerPrefs.GetInt("ShipCameraTilt", 1) == 1; |
| } |
| } |
| |
| |
| private void LateUpdate() |
| private void LateUpdate() |
| { |
| { |
| float deltaTime = Time.deltaTime; |
| float deltaTime = Time.deltaTime; |
| if (ZInput.GetKeyDown(KeyCode.F11, true) || (this.m_freeFly && ZInput.GetKeyDown(KeyCode.Mouse1, true))) |
| if (ZInput.GetKeyDown(KeyCode.F11, true) || (this.m_freeFly && ZInput.GetKeyDown(KeyCode.Mouse1, true))) |
| { |
| { |
| GameCamera.ScreenShot(); |
| GameCamera.ScreenShot(); |
| } |
| } |
| Player localPlayer = Player.m_localPlayer; |
| Player localPlayer = Player.m_localPlayer; |
| if (localPlayer) |
| if (localPlayer) |
| { |
| { |
| this.UpdateBaseOffset(localPlayer, deltaTime); |
| this.UpdateBaseOffset(localPlayer, deltaTime); |
| } |
| } |
| this.UpdateMouseCapture(); |
| this.UpdateMouseCapture(); |
| this.UpdateCamera(Time.unscaledDeltaTime); |
| this.UpdateCamera(Time.unscaledDeltaTime); |
| this.UpdateListner(); |
| this.UpdateListner(); |
| } |
| } |
| |
| |
| private void UpdateMouseCapture() |
| private void UpdateMouseCapture() |
| { |
| { |
| if (ZInput.GetKey(KeyCode.LeftControl, true) && ZInput.GetKeyDown(KeyCode.F1, true)) |
| if (ZInput.GetKey(KeyCode.LeftControl, true) && ZInput.GetKeyDown(KeyCode.F1, true)) |
| { |
| { |
| this.m_mouseCapture = !this.m_mouseCapture; |
| this.m_mouseCapture = !this.m_mouseCapture; |
| } |
| } |
| if (this.m_mouseCapture && !Hud.InRadial() && !InventoryGui.IsVisible() && !TextInput.IsVisible() && !Menu.IsVisible() && !Minimap.IsOpen() && !StoreGui.IsVisible() && !Hud.IsPieceSelectionVisible() && !PlayerCustomizaton.BarberBlocksLook() && !UnifiedPopup.IsVisible()) |
| if (this.m_mouseCapture && !Hud.InRadial() && !InventoryGui.IsVisible() && !TextInput.IsVisible() && !Menu.IsVisible() && !Minimap.IsOpen() && !StoreGui.IsVisible() && !Hud.IsPieceSelectionVisible() && !PlayerCustomizaton.BarberBlocksLook() && !UnifiedPopup.IsVisible()) |
| { |
| { |
| Cursor.lockState = CursorLockMode.Locked; |
| Cursor.lockState = CursorLockMode.Locked; |
| Cursor.visible = false; |
| Cursor.visible = false; |
| return; |
| return; |
| } |
| } |
| if (Hud.InRadial()) |
| if (Hud.InRadial()) |
| { |
| { |
| Cursor.lockState = (RadialConfigHelper.MouseMode ? CursorLockMode.Confined : CursorLockMode.Locked); |
| Cursor.lockState = (RadialConfigHelper.MouseMode ? CursorLockMode.Confined : CursorLockMode.Locked); |
| Cursor.visible = false; |
| Cursor.visible = false; |
| return; |
| return; |
| } |
| } |
| if (!Menu.IsVisible() || UnifiedPopup.IsVisible()) |
| if (!Menu.IsVisible() || UnifiedPopup.IsVisible()) |
| { |
| { |
| Cursor.lockState = CursorLockMode.None; |
| Cursor.lockState = CursorLockMode.None; |
| Cursor.visible = ZInput.IsMouseActive(); |
| Cursor.visible = ZInput.IsMouseActive(); |
| } |
| } |
| } |
| } |
| |
| |
| public static void ScreenShot() |
| public static void ScreenShot() |
| { |
| { |
| DateTime now = DateTime.Now; |
| DateTime now = DateTime.Now; |
| Directory.CreateDirectory(Utils.GetSaveDataPath(FileHelpers.FileSource.Local) + "/screenshots"); |
| Directory.CreateDirectory(Utils.GetSaveDataPath(FileHelpers.FileSource.Local) + "/screenshots"); |
| string text = now.Hour.ToString("00") + now.Minute.ToString("00") + now.Second.ToString("00"); |
| string text = now.Hour.ToString("00") + now.Minute.ToString("00") + now.Second.ToString("00"); |
| string text2 = now.ToString("yyyy-MM-dd"); |
| string text2 = now.ToString("yyyy-MM-dd"); |
| string text3 = string.Concat(new string[] |
| string text3 = string.Concat(new string[] |
| { |
| { |
| Utils.GetSaveDataPath(FileHelpers.FileSource.Local), |
| Utils.GetSaveDataPath(FileHelpers.FileSource.Local), |
| "/screenshots/screenshot_", |
| "/screenshots/screenshot_", |
| text2, |
| text2, |
| "_", |
| "_", |
| text, |
| text, |
| ".png" |
| ".png" |
| }); |
| }); |
| if (File.Exists(text3)) |
| if (File.Exists(text3)) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| ScreenCapture.CaptureScreenshot(text3); |
| ScreenCapture.CaptureScreenshot(text3); |
| ZLog.Log("Screenshot saved:" + text3); |
| ZLog.Log("Screenshot saved:" + text3); |
| } |
| } |
| |
| |
| private void UpdateListner() |
| private void UpdateListner() |
| { |
| { |
| Player localPlayer = Player.m_localPlayer; |
| Player localPlayer = Player.m_localPlayer; |
| if (localPlayer && !this.m_freeFly) |
| if (localPlayer && !this.m_freeFly) |
| { |
| { |
| this.m_listner.transform.position = localPlayer.m_eye.position; |
| this.m_listner.transform.position = localPlayer.m_eye.position; |
| return; |
| return; |
| } |
| } |
| this.m_listner.transform.localPosition = Vector3.zero; |
| this.m_listner.transform.localPosition = Vector3.zero; |
| } |
| } |
| |
| |
| private void UpdateCamera(float dt) |
| private void UpdateCamera(float dt) |
| { |
| { |
| if (this.m_freeFly) |
| if (this.m_freeFly) |
| { |
| { |
| this.UpdateFreeFly(dt); |
| this.UpdateFreeFly(dt); |
| this.UpdateCameraShake(dt); |
| this.UpdateCameraShake(dt); |
| this.<UpdateCamera>g__debugCamera|9_0(ZInput.GetMouseScrollWheel()); |
| this.<UpdateCamera>g__debugCamera|9_0(ZInput.GetMouseScrollWheel()); |
| return; |
| return; |
| } |
| } |
| this.m_camera.fieldOfView = this.m_fov; |
| this.m_camera.fieldOfView = this.m_fov; |
| this.m_skyCamera.fieldOfView = this.m_fov; |
| this.m_skyCamera.fieldOfView = this.m_fov; |
| Player localPlayer = Player.m_localPlayer; |
| Player localPlayer = Player.m_localPlayer; |
| if (localPlayer) |
| if (localPlayer) |
| { |
| { |
| if ((!Chat.instance || !Chat.instance.HasFocus()) && !global::Console.IsVisible() && !InventoryGui.IsVisible() && !StoreGui.IsVisible() && !Menu.IsVisible() && !Minimap.IsOpen() && !Hud.IsPieceSelectionVisible() && !Hud.InRadial() && !localPlayer.InCutscene() && (!localPlayer.InPlaceMode() || localPlayer.InRepairMode() || !localPlayer.CanRotatePiece() || localPlayer.GetPlacementStatus() == Player.PlacementStatus.NoRayHits || ZInput.IsGamepadActive())) |
| if ((!Chat.instance || !Chat.instance.HasFocus()) && !global::Console.IsVisible() && !InventoryGui.IsVisible() && !StoreGui.IsVisible() && !Menu.IsVisible() && !Minimap.IsOpen() && !Hud.IsPieceSelectionVisible() && !Hud.InRadial() && !localPlayer.InCutscene() && (!localPlayer.InPlaceMode() || localPlayer.InRepairMode() || !localPlayer.CanRotatePiece() || localPlayer.GetPlacementStatus() == Player.PlacementStatus.NoRayHits || ZInput.IsGamepadActive())) |
| { |
| { |
| float minDistance = this.m_minDistance; |
| float minDistance = this.m_minDistance; |
| float num = ZInput.GetMouseScrollWheel(); |
| float num = ZInput.GetMouseScrollWheel(); |
| if (Player.m_debugMode) |
| if (Player.m_debugMode) |
| { |
| { |
| num = this.<UpdateCamera>g__debugCamera|9_0(num); |
| num = this.<UpdateCamera>g__debugCamera|9_0(num); |
| } |
| } |
| this.m_distance -= num * this.m_zoomSens; |
| this.m_distance -= num * this.m_zoomSens; |
| . | if (ZInput.GetButton("JoyAltKeys") && !Hud.InRadial() && ZInput.GetButton("JoyCamZoom")) |
| if (ZInput.GetButton("JoyAltKeys") && !Hud.InRadial()) |
| { |
| { |
| . | this.m_distance += this.m_zoomSens * dt * (float)(this.m_camZoomToggle ? 1 : (-1)); |
| if (ZInput.GetButton("JoyCamZoomIn")) |
| } |
| { |
| if (ZInput.GetButtonUp("JoyAltKeys") && !Hud.InRadial()) |
| this.m_distance -= this.m_zoomSens * dt; |
| { |
| } |
| this.m_camZoomToggle = !this.m_camZoomToggle; |
| else if (ZInput.GetButton("JoyCamZoomOut")) |
| |
| { |
| |
| this.m_distance += this.m_zoomSens * dt; |
| |
| } |
| } |
| } |
| float num2 = ((localPlayer.GetControlledShip() != null) ? this.m_maxDistanceBoat : this.m_maxDistance); |
| float num2 = ((localPlayer.GetControlledShip() != null) ? this.m_maxDistanceBoat : this.m_maxDistance); |
| this.m_distance = Mathf.Clamp(this.m_distance, minDistance, num2); |
| this.m_distance = Mathf.Clamp(this.m_distance, minDistance, num2); |
| } |
| } |
| if (localPlayer.IsDead() && localPlayer.GetRagdoll()) |
| if (localPlayer.IsDead() && localPlayer.GetRagdoll()) |
| { |
| { |
| Vector3 averageBodyPosition = localPlayer.GetRagdoll().GetAverageBodyPosition(); |
| Vector3 averageBodyPosition = localPlayer.GetRagdoll().GetAverageBodyPosition(); |
| base.transform.LookAt(averageBodyPosition); |
| base.transform.LookAt(averageBodyPosition); |
| } |
| } |
| else if (localPlayer.IsAttached() && localPlayer.GetAttachCameraPoint() != null) |
| else if (localPlayer.IsAttached() && localPlayer.GetAttachCameraPoint() != null) |
| { |
| { |
| Transform attachCameraPoint = localPlayer.GetAttachCameraPoint(); |
| Transform attachCameraPoint = localPlayer.GetAttachCameraPoint(); |
| base.transform.position = attachCameraPoint.position; |
| base.transform.position = attachCameraPoint.position; |
| base.transform.rotation = attachCameraPoint.rotation; |
| base.transform.rotation = attachCameraPoint.rotation; |
| } |
| } |
| else |
| else |
| { |
| { |
| Vector3 vector; |
| Vector3 vector; |
| Quaternion quaternion; |
| Quaternion quaternion; |
| this.GetCameraPosition(dt, out vector, out quaternion); |
| this.GetCameraPosition(dt, out vector, out quaternion); |
| base.transform.position = vector; |
| base.transform.position = vector; |
| base.transform.rotation = quaternion; |
| base.transform.rotation = quaternion; |
| } |
| } |
| this.UpdateCameraShake(dt); |
| this.UpdateCameraShake(dt); |
| } |
| } |
| } |
| } |
| |
| |
| private void GetCameraPosition(float dt, out Vector3 pos, out Quaternion rot) |
| private void GetCameraPosition(float dt, out Vector3 pos, out Quaternion rot) |
| { |
| { |
| Player localPlayer = Player.m_localPlayer; |
| Player localPlayer = Player.m_localPlayer; |
| if (localPlayer == null) |
| if (localPlayer == null) |
| { |
| { |
| pos = base.transform.position; |
| pos = base.transform.position; |
| rot = base.transform.rotation; |
| rot = base.transform.rotation; |
| return; |
| return; |
| } |
| } |
| Vector3 vector = this.GetOffsetedEyePos(); |
| Vector3 vector = this.GetOffsetedEyePos(); |
| float num = this.m_distance; |
| float num = this.m_distance; |
| if (localPlayer.InIntro()) |
| if (localPlayer.InIntro()) |
| { |
| { |
| vector = localPlayer.transform.position; |
| vector = localPlayer.transform.position; |
| num = this.m_flyingDistance; |
| num = this.m_flyingDistance; |
| } |
| } |
| Vector3 vector2 = -localPlayer.m_eye.transform.forward; |
| Vector3 vector2 = -localPlayer.m_eye.transform.forward; |
| if (this.m_smoothYTilt && !localPlayer.InIntro()) |
| if (this.m_smoothYTilt && !localPlayer.InIntro()) |
| { |
| { |
| num = Mathf.Lerp(num, 1.5f, Utils.SmoothStep(0f, -0.5f, vector2.y)); |
| num = Mathf.Lerp(num, 1.5f, Utils.SmoothStep(0f, -0.5f, vector2.y)); |
| } |
| } |
| Vector3 vector3 = vector + vector2 * num; |
| Vector3 vector3 = vector + vector2 * num; |
| this.CollideRay2(localPlayer.m_eye.position, vector, ref vector3); |
| this.CollideRay2(localPlayer.m_eye.position, vector, ref vector3); |
| this.UpdateNearClipping(vector, vector3, dt); |
| this.UpdateNearClipping(vector, vector3, dt); |
| float liquidLevel = Floating.GetLiquidLevel(vector3, 1f, LiquidType.All); |
| float liquidLevel = Floating.GetLiquidLevel(vector3, 1f, LiquidType.All); |
| if (vector3.y < liquidLevel + this.m_minWaterDistance) |
| if (vector3.y < liquidLevel + this.m_minWaterDistance) |
| { |
| { |
| vector3.y = liquidLevel + this.m_minWaterDistance; |
| vector3.y = liquidLevel + this.m_minWaterDistance; |
| this.m_waterClipping = true; |
| this.m_waterClipping = true; |
| } |
| } |
| else |
| else |
| { |
| { |
| this.m_waterClipping = false; |
| this.m_waterClipping = false; |
| } |
| } |
| pos = vector3; |
| pos = vector3; |
| rot = localPlayer.m_eye.transform.rotation; |
| rot = localPlayer.m_eye.transform.rotation; |
| if (this.m_shipCameraTilt) |
| if (this.m_shipCameraTilt) |
| { |
| { |
| this.ApplyCameraTilt(localPlayer, dt, ref rot); |
| this.ApplyCameraTilt(localPlayer, dt, ref rot); |
| } |
| } |
| } |
| } |
| |
| |
| private void ApplyCameraTilt(Player player, float dt, ref Quaternion rot) |
| private void ApplyCameraTilt(Player player, float dt, ref Quaternion rot) |
| { |
| { |
| if (player.InIntro()) |
| if (player.InIntro()) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| Ship standingOnShip = player.GetStandingOnShip(); |
| Ship standingOnShip = player.GetStandingOnShip(); |
| float num = Mathf.Clamp01((this.m_distance - this.m_minDistance) / (this.m_maxDistanceBoat - this.m_minDistance)); |
| float num = Mathf.Clamp01((this.m_distance - this.m_minDistance) / (this.m_maxDistanceBoat - this.m_minDistance)); |
| num = Mathf.Pow(num, 2f); |
| num = Mathf.Pow(num, 2f); |
| float num2 = Mathf.Lerp(this.m_tiltSmoothnessShipMin, this.m_tiltSmoothnessShipMax, num); |
| float num2 = Mathf.Lerp(this.m_tiltSmoothnessShipMin, this.m_tiltSmoothnessShipMax, num); |
| Vector3 vector = Vector3.up; |
| Vector3 vector = Vector3.up; |
| if (standingOnShip != null && standingOnShip.transform.up.y > 0f) |
| if (standingOnShip != null && standingOnShip.transform.up.y > 0f) |
| { |
| { |
| vector = standingOnShip.transform.up; |
| vector = standingOnShip.transform.up; |
| } |
| } |
| else if (player.IsAttached()) |
| else if (player.IsAttached()) |
| { |
| { |
| vector = player.GetVisual().transform.up; |
| vector = player.GetVisual().transform.up; |
| } |
| } |
| Vector3 forward = player.m_eye.transform.forward; |
| Vector3 forward = player.m_eye.transform.forward; |
| Vector3 vector2 = Vector3.Lerp(vector, Vector3.up, num * 0.5f); |
| Vector3 vector2 = Vector3.Lerp(vector, Vector3.up, num * 0.5f); |
| this.m_smoothedCameraUp = Vector3.SmoothDamp(this.m_smoothedCameraUp, vector2, ref this.m_smoothedCameraUpVel, num2, 99f, dt); |
| this.m_smoothedCameraUp = Vector3.SmoothDamp(this.m_smoothedCameraUp, vector2, ref this.m_smoothedCameraUpVel, num2, 99f, dt); |
| rot = Quaternion.LookRotation(forward, this.m_smoothedCameraUp); |
| rot = Quaternion.LookRotation(forward, this.m_smoothedCameraUp); |
| } |
| } |
| |
| |
| private void UpdateNearClipping(Vector3 eyePos, Vector3 camPos, float dt) |
| private void UpdateNearClipping(Vector3 eyePos, Vector3 camPos, float dt) |
| { |
| { |
| float num = this.m_nearClipPlaneMax; |
| float num = this.m_nearClipPlaneMax; |
| Vector3 normalized = (camPos - eyePos).normalized; |
| Vector3 normalized = (camPos - eyePos).normalized; |
| if (this.m_waterClipping || Physics.CheckSphere(camPos - normalized * this.m_nearClipPlaneMax, this.m_nearClipPlaneMax, this.m_blockCameraMask)) |
| if (this.m_waterClipping || Physics.CheckSphere(camPos - normalized * this.m_nearClipPlaneMax, this.m_nearClipPlaneMax, this.m_blockCameraMask)) |
| { |
| { |
| num = this.m_nearClipPlaneMin; |
| num = this.m_nearClipPlaneMin; |
| } |
| } |
| if (this.m_camera.nearClipPlane != num) |
| if (this.m_camera.nearClipPlane != num) |
| { |
| { |
| this.m_camera.nearClipPlane = num; |
| this.m_camera.nearClipPlane = num; |
| } |
| } |
| } |
| } |
| |
| |
| private void CollideRay2(Vector3 eyePos, Vector3 offsetedEyePos, ref Vector3 end) |
| private void CollideRay2(Vector3 eyePos, Vector3 offsetedEyePos, ref Vector3 end) |
| { |
| { |
| float num; |
| float num; |
| if (this.RayTestPoint(eyePos, offsetedEyePos, (end - offsetedEyePos).normalized, Vector3.Distance(eyePos, end), out num)) |
| if (this.RayTestPoint(eyePos, offsetedEyePos, (end - offsetedEyePos).normalized, Vector3.Distance(eyePos, end), out num)) |
| { |
| { |
| float num2 = Utils.LerpStep(0.5f, 2f, num); |
| float num2 = Utils.LerpStep(0.5f, 2f, num); |
| Vector3 vector = eyePos + (end - eyePos).normalized * num; |
| Vector3 vector = eyePos + (end - eyePos).normalized * num; |
| Vector3 vector2 = offsetedEyePos + (end - offsetedEyePos).normalized * num; |
| Vector3 vector2 = offsetedEyePos + (end - offsetedEyePos).normalized * num; |
| end = Vector3.Lerp(vector, vector2, num2); |
| end = Vector3.Lerp(vector, vector2, num2); |
| } |
| } |
| } |
| } |
| |
| |
| private bool RayTestPoint(Vector3 point, Vector3 offsetedPoint, Vector3 dir, float maxDist, out float distance) |
| private bool RayTestPoint(Vector3 point, Vector3 offsetedPoint, Vector3 dir, float maxDist, out float distance) |
| { |
| { |
| bool flag = false; |
| bool flag = false; |
| distance = maxDist; |
| distance = maxDist; |
| . | |
| float num = ZoneSystem.instance.GetGroundOffset(point) * 1.6f; |
| |
| offsetedPoint += new Vector3(0f, -num, 0f); |
| RaycastHit raycastHit; |
| RaycastHit raycastHit; |
| if (Physics.SphereCast(offsetedPoint, this.m_raycastWidth, dir, out raycastHit, maxDist, this.m_blockCameraMask)) |
| if (Physics.SphereCast(offsetedPoint, this.m_raycastWidth, dir, out raycastHit, maxDist, this.m_blockCameraMask)) |
| { |
| { |
| distance = raycastHit.distance; |
| distance = raycastHit.distance; |
| flag = true; |
| flag = true; |
| } |
| } |
| offsetedPoint + dir * distance; |
| offsetedPoint + dir * distance; |
| if (Physics.SphereCast(point, this.m_raycastWidth, dir, out raycastHit, maxDist, this.m_blockCameraMask)) |
| if (Physics.SphereCast(point, this.m_raycastWidth, dir, out raycastHit, maxDist, this.m_blockCameraMask)) |
| { |
| { |
| if (raycastHit.distance < distance) |
| if (raycastHit.distance < distance) |
| { |
| { |
| distance = raycastHit.distance; |
| distance = raycastHit.distance; |
| } |
| } |
| flag = true; |
| flag = true; |
| } |
| } |
| . | if (Physics.Raycast(point, dir, out raycastHit, maxDist, this.m_blockCameraMask)) |
| if (Physics.Raycast(point - new Vector3(0f, num, 0f), dir, out raycastHit, maxDist, this.m_blockCameraMask)) |
| { |
| { |
| . | float num = raycastHit.distance - this.m_nearClipPlaneMin; |
| float num2 = raycastHit.distance - this.m_nearClipPlaneMin; |
| if (num < distance) |
| if (num2 < distance) |
| { |
| { |
| . | distance = num; |
| distance = num2; |
| } |
| } |
| flag = true; |
| flag = true; |
| } |
| } |
| . | |
| if (flag) |
| |
| { |
| |
| Vector3 vector = point + dir.normalized * distance; |
| |
| float num3 = Mathf.Max(ZoneSystem.instance.GetGroundOffset(vector) * 1.6f, num); |
| |
| if (num3 > 0f && Physics.Raycast(point + new Vector3(0f, -num3, 0f), dir, out raycastHit, maxDist, this.m_blockCameraMask)) |
| |
| { |
| |
| float num4 = raycastHit.distance - this.m_nearClipPlaneMin; |
| |
| if (num4 < distance) |
| |
| { |
| |
| distance = num4; |
| |
| } |
| |
| } |
| |
| } |
| return flag; |
| return flag; |
| } |
| } |
| |
| |
| private bool RayTestPoint(Vector3 point, Vector3 dir, float maxDist, out Vector3 hitPoint) |
| private bool RayTestPoint(Vector3 point, Vector3 dir, float maxDist, out Vector3 hitPoint) |
| { |
| { |
| RaycastHit raycastHit; |
| RaycastHit raycastHit; |
| if (Physics.SphereCast(point, 0.2f, dir, out raycastHit, maxDist, this.m_blockCameraMask)) |
| if (Physics.SphereCast(point, 0.2f, dir, out raycastHit, maxDist, this.m_blockCameraMask)) |
| { |
| { |
| hitPoint = point + dir * raycastHit.distance; |
| hitPoint = point + dir * raycastHit.distance; |
| return true; |
| return true; |
| } |
| } |
| if (Physics.Raycast(point, dir, out raycastHit, maxDist, this.m_blockCameraMask)) |
| if (Physics.Raycast(point, dir, out raycastHit, maxDist, this.m_blockCameraMask)) |
| { |
| { |
| hitPoint = point + dir * (raycastHit.distance - 0.05f); |
| hitPoint = point + dir * (raycastHit.distance - 0.05f); |
| return true; |
| return true; |
| } |
| } |
| hitPoint = Vector3.zero; |
| hitPoint = Vector3.zero; |
| return false; |
| return false; |
| } |
| } |
| |
| |
| private void UpdateFreeFly(float dt) |
| private void UpdateFreeFly(float dt) |
| { |
| { |
| if (global::Console.IsVisible()) |
| if (global::Console.IsVisible()) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| Vector2 vector = Vector2.zero; |
| Vector2 vector = Vector2.zero; |
| vector = ZInput.GetMouseDelta(); |
| vector = ZInput.GetMouseDelta(); |
| vector.x += ZInput.GetJoyRightStickX() * 110f * dt; |
| vector.x += ZInput.GetJoyRightStickX() * 110f * dt; |
| vector.y += -ZInput.GetJoyRightStickY() * 110f * dt; |
| vector.y += -ZInput.GetJoyRightStickY() * 110f * dt; |
| this.m_freeFlyYaw += vector.x; |
| this.m_freeFlyYaw += vector.x; |
| this.m_freeFlyPitch -= vector.y; |
| this.m_freeFlyPitch -= vector.y; |
| if (ZInput.GetMouseScrollWheel() < 0f) |
| if (ZInput.GetMouseScrollWheel() < 0f) |
| { |
| { |
| this.m_freeFlySpeed *= 0.8f; |
| this.m_freeFlySpeed *= 0.8f; |
| } |
| } |
| if (ZInput.GetMouseScrollWheel() > 0f) |
| if (ZInput.GetMouseScrollWheel() > 0f) |
| { |
| { |
| this.m_freeFlySpeed *= 1.2f; |
| this.m_freeFlySpeed *= 1.2f; |
| } |
| } |
| if (ZInput.GetMouseScrollWheel() > 0f) |
| if (ZInput.GetMouseScrollWheel() > 0f) |
| { |
| { |
| this.m_freeFlySpeed *= 1.2f; |
| this.m_freeFlySpeed *= 1.2f; |
| } |
| } |
| if (ZInput.GetButton("JoyTabLeft")) |
| if (ZInput.GetButton("JoyTabLeft")) |
| { |
| { |
| this.m_camera.fieldOfView = Mathf.Max(this.m_freeFlyMinFov, this.m_camera.fieldOfView - dt * 20f); |
| this.m_camera.fieldOfView = Mathf.Max(this.m_freeFlyMinFov, this.m_camera.fieldOfView - dt * 20f); |
| } |
| } |
| if (ZInput.GetButton("JoyTabRight")) |
| if (ZInput.GetButton("JoyTabRight")) |
| { |
| { |
| this.m_camera.fieldOfView = Mathf.Min(this.m_freeFlyMaxFov, this.m_camera.fieldOfView + dt * 20f); |
| this.m_camera.fieldOfView = Mathf.Min(this.m_freeFlyMaxFov, this.m_camera.fieldOfView + dt * 20f); |
| } |
| } |
| this.m_skyCamera.fieldOfView = this.m_camera.fieldOfView; |
| this.m_skyCamera.fieldOfView = this.m_camera.fieldOfView; |
| if (ZInput.GetButton("JoyButtonY")) |
| if (ZInput.GetButton("JoyButtonY")) |
| { |
| { |
| this.m_freeFlySpeed += this.m_freeFlySpeed * 0.1f * dt * 10f; |
| this.m_freeFlySpeed += this.m_freeFlySpeed * 0.1f * dt * 10f; |
| } |
| } |
| if (ZInput.GetButton("JoyButtonX")) |
| if (ZInput.GetButton("JoyButtonX")) |
| { |
| { |
| this.m_freeFlySpeed -= this.m_freeFlySpeed * 0.1f * dt * 10f; |
| this.m_freeFlySpeed -= this.m_freeFlySpeed * 0.1f * dt * 10f; |
| } |
| } |
| this.m_freeFlySpeed = Mathf.Clamp(this.m_freeFlySpeed, 1f, 1000f); |
| this.m_freeFlySpeed = Mathf.Clamp(this.m_freeFlySpeed, 1f, 1000f); |
| if (ZInput.GetButtonDown("JoyLStick") || ZInput.GetButtonDown("SecondaryAttack")) |
| if (ZInput.GetButtonDown("JoyLStick") || ZInput.GetButtonDown("SecondaryAttack")) |
| { |
| { |
| if (this.m_freeFlyLockon) |
| if (this.m_freeFlyLockon) |
| { |
| { |
| this.m_freeFlyLockon = null; |
| this.m_freeFlyLockon = null; |
| } |
| } |
| else |
| else |
| { |
| { |
| int mask = LayerMask.GetMask(new string[] { "Default", "static_solid", "terrain", "vehicle", "character", "piece", "character_net", "viewblock" }); |
| int mask = LayerMask.GetMask(new string[] { "Default", "static_solid", "terrain", "vehicle", "character", "piece", "character_net", "viewblock" }); |
| RaycastHit raycastHit; |
| RaycastHit raycastHit; |
| if (Physics.Raycast(base.transform.position, base.transform.forward, out raycastHit, 10000f, mask)) |
| if (Physics.Raycast(base.transform.position, base.transform.forward, out raycastHit, 10000f, mask)) |
| { |
| { |
| this.m_freeFlyLockon = raycastHit.collider.transform; |
| this.m_freeFlyLockon = raycastHit.collider.transform; |
| this.m_freeFlyLockonOffset = this.m_freeFlyLockon.InverseTransformPoint(base.transform.position); |
| this.m_freeFlyLockonOffset = this.m_freeFlyLockon.InverseTransformPoint(base.transform.position); |
| } |
| } |
| } |
| } |
| } |
| } |
| Vector3 vector2 = Vector3.zero; |
| Vector3 vector2 = Vector3.zero; |
| if (ZInput.GetButton("Left")) |
| if (ZInput.GetButton("Left")) |
| { |
| { |
| vector2 -= Vector3.right; |
| vector2 -= Vector3.right; |
| } |
| } |
| if (ZInput.GetButton("Right")) |
| if (ZInput.GetButton("Right")) |
| { |
| { |
| vector2 += Vector3.right; |
| vector2 += Vector3.right; |
| } |
| } |
| if (ZInput.GetButton("Forward")) |
| if (ZInput.GetButton("Forward")) |
| { |
| { |
| vector2 += Vector3.forward; |
| vector2 += Vector3.forward; |
| } |
| } |
| if (ZInput.GetButton("Backward")) |
| if (ZInput.GetButton("Backward")) |
| { |
| { |
| vector2 -= Vector3.forward; |
| vector2 -= Vector3.forward; |
| } |
| } |
| if (ZInput.GetButton("Jump")) |
| if (ZInput.GetButton("Jump")) |
| { |
| { |
| vector2 += Vector3.up; |
| vector2 += Vector3.up; |
| } |
| } |
| if (ZInput.GetButton("Crouch")) |
| if (ZInput.GetButton("Crouch")) |
| { |
| { |
| vector2 -= Vector3.up; |
| vector2 -= Vector3.up; |
| } |
| } |
| vector2 += Vector3.up * ZInput.GetJoyRTrigger(); |
| vector2 += Vector3.up * ZInput.GetJoyRTrigger(); |
| vector2 -= Vector3.up * ZInput.GetJoyLTrigger(); |
| vector2 -= Vector3.up * ZInput.GetJoyLTrigger(); |
| vector2 += Vector3.right * ZInput.GetJoyLeftStickX(false); |
| vector2 += Vector3.right * ZInput.GetJoyLeftStickX(false); |
| vector2 += -Vector3.forward * ZInput.GetJoyLeftStickY(true); |
| vector2 += -Vector3.forward * ZInput.GetJoyLeftStickY(true); |
| if (ZInput.GetButtonDown("JoyButtonB") || ZInput.GetButtonDown("Block")) |
| if (ZInput.GetButtonDown("JoyButtonB") || ZInput.GetButtonDown("Block")) |
| { |
| { |
| this.m_freeFlySavedVel = vector2; |
| this.m_freeFlySavedVel = vector2; |
| } |
| } |
| float magnitude = this.m_freeFlySavedVel.magnitude; |
| float magnitude = this.m_freeFlySavedVel.magnitude; |
| if (magnitude > 0.001f) |
| if (magnitude > 0.001f) |
| { |
| { |
| vector2 += this.m_freeFlySavedVel; |
| vector2 += this.m_freeFlySavedVel; |
| if (vector2.magnitude > magnitude) |
| if (vector2.magnitude > magnitude) |
| { |
| { |
| vector2 = vector2.normalized * magnitude; |
| vector2 = vector2.normalized * magnitude; |
| } |
| } |
| } |
| } |
| if (vector2.magnitude > 1f) |
| if (vector2.magnitude > 1f) |
| { |
| { |
| vector2.Normalize(); |
| vector2.Normalize(); |
| } |
| } |
| vector2 = base.transform.TransformVector(vector2); |
| vector2 = base.transform.TransformVector(vector2); |
| vector2 *= this.m_freeFlySpeed; |
| vector2 *= this.m_freeFlySpeed; |
| if (this.m_freeFlySmooth <= 0f) |
| if (this.m_freeFlySmooth <= 0f) |
| { |
| { |
| this.m_freeFlyVel = vector2; |
| this.m_freeFlyVel = vector2; |
| } |
| } |
| else |
| else |
| { |
| { |
| this.m_freeFlyVel = Vector3.SmoothDamp(this.m_freeFlyVel, vector2, ref this.m_freeFlyAcc, this.m_freeFlySmooth, 99f, dt); |
| this.m_freeFlyVel = Vector3.SmoothDamp(this.m_freeFlyVel, vector2, ref this.m_freeFlyAcc, this.m_freeFlySmooth, 99f, dt); |
| } |
| } |
| if (this.m_freeFlyLockon) |
| if (this.m_freeFlyLockon) |
| { |
| { |
| this.m_freeFlyLockonOffset += this.m_freeFlyLockon.InverseTransformVector(this.m_freeFlyVel * dt); |
| this.m_freeFlyLockonOffset += this.m_freeFlyLockon.InverseTransformVector(this.m_freeFlyVel * dt); |
| base.transform.position = this.m_freeFlyLockon.TransformPoint(this.m_freeFlyLockonOffset); |
| base.transform.position = this.m_freeFlyLockon.TransformPoint(this.m_freeFlyLockonOffset); |
| } |
| } |
| else |
| else |
| { |
| { |
| base.transform.position = base.transform.position + this.m_freeFlyVel * dt; |
| base.transform.position = base.transform.position + this.m_freeFlyVel * dt; |
| } |
| } |
| Quaternion quaternion = Quaternion.Euler(0f, this.m_freeFlyYaw, 0f) * Quaternion.Euler(this.m_freeFlyPitch, 0f, 0f); |
| Quaternion quaternion = Quaternion.Euler(0f, this.m_freeFlyYaw, 0f) * Quaternion.Euler(this.m_freeFlyPitch, 0f, 0f); |
| if (this.m_freeFlyLockon) |
| if (this.m_freeFlyLockon) |
| { |
| { |
| quaternion = this.m_freeFlyLockon.rotation * quaternion; |
| quaternion = this.m_freeFlyLockon.rotation * quaternion; |
| } |
| } |
| if ((ZInput.GetButtonDown("JoyRStick") && !ZInput.GetButton("JoyAltKeys")) || ZInput.GetButtonDown("Attack")) |
| if ((ZInput.GetButtonDown("JoyRStick") && !ZInput.GetButton("JoyAltKeys")) || ZInput.GetButtonDown("Attack")) |
| { |
| { |
| if (this.m_freeFlyTarget) |
| if (this.m_freeFlyTarget) |
| { |
| { |
| this.m_freeFlyTarget = null; |
| this.m_freeFlyTarget = null; |
| } |
| } |
| else |
| else |
| { |
| { |
| int mask2 = LayerMask.GetMask(new string[] { "Default", "static_solid", "terrain", "vehicle", "character", "piece", "character_net", "viewblock" }); |
| int mask2 = LayerMask.GetMask(new string[] { "Default", "static_solid", "terrain", "vehicle", "character", "piece", "character_net", "viewblock" }); |
| RaycastHit raycastHit2; |
| RaycastHit raycastHit2; |
| if (Physics.Raycast(base.transform.position, base.transform.forward, out raycastHit2, 10000f, mask2)) |
| if (Physics.Raycast(base.transform.position, base.transform.forward, out raycastHit2, 10000f, mask2)) |
| { |
| { |
| this.m_freeFlyTarget = raycastHit2.collider.transform; |
| this.m_freeFlyTarget = raycastHit2.collider.transform; |
| this.m_freeFlyTargetOffset = this.m_freeFlyTarget.InverseTransformPoint(raycastHit2.point); |
| this.m_freeFlyTargetOffset = this.m_freeFlyTarget.InverseTransformPoint(raycastHit2.point); |
| } |
| } |
| } |
| } |
| } |
| } |
| if (this.m_freeFlyTarget) |
| if (this.m_freeFlyTarget) |
| { |
| { |
| quaternion = Quaternion.LookRotation((this.m_freeFlyTarget.TransformPoint(this.m_freeFlyTargetOffset) - base.transform.position).normalized, Vector3.up); |
| quaternion = Quaternion.LookRotation((this.m_freeFlyTarget.TransformPoint(this.m_freeFlyTargetOffset) - base.transform.position).normalized, Vector3.up); |
| } |
| } |
| if (this.m_freeFlySmooth <= 0f) |
| if (this.m_freeFlySmooth <= 0f) |
| { |
| { |
| base.transform.rotation = quaternion; |
| base.transform.rotation = quaternion; |
| return; |
| return; |
| } |
| } |
| Quaternion quaternion2 = Utils.SmoothDamp(base.transform.rotation, quaternion, ref this.m_freeFlyRef, this.m_freeFlySmooth, 9999f, dt); |
| Quaternion quaternion2 = Utils.SmoothDamp(base.transform.rotation, quaternion, ref this.m_freeFlyRef, this.m_freeFlySmooth, 9999f, dt); |
| base.transform.rotation = quaternion2; |
| base.transform.rotation = quaternion2; |
| } |
| } |
| |
| |
| private void UpdateCameraShake(float dt) |
| private void UpdateCameraShake(float dt) |
| { |
| { |
| this.m_shakeIntensity -= dt; |
| this.m_shakeIntensity -= dt; |
| if (this.m_shakeIntensity <= 0f) |
| if (this.m_shakeIntensity <= 0f) |
| { |
| { |
| this.m_shakeIntensity = 0f; |
| this.m_shakeIntensity = 0f; |
| return; |
| return; |
| } |
| } |
| float num = this.m_shakeIntensity * this.m_shakeIntensity * this.m_shakeIntensity; |
| float num = this.m_shakeIntensity * this.m_shakeIntensity * this.m_shakeIntensity; |
| this.m_shakeTimer += dt * Mathf.Clamp01(this.m_shakeIntensity) * this.m_shakeFreq; |
| this.m_shakeTimer += dt * Mathf.Clamp01(this.m_shakeIntensity) * this.m_shakeFreq; |
| Quaternion quaternion = Quaternion.Euler(Mathf.Sin(this.m_shakeTimer) * num * this.m_shakeMovement, Mathf.Cos(this.m_shakeTimer * 0.9f) * num * this.m_shakeMovement, 0f); |
| Quaternion quaternion = Quaternion.Euler(Mathf.Sin(this.m_shakeTimer) * num * this.m_shakeMovement, Mathf.Cos(this.m_shakeTimer * 0.9f) * num * this.m_shakeMovement, 0f); |
| base.transform.rotation = base.transform.rotation * quaternion; |
| base.transform.rotation = base.transform.rotation * quaternion; |
| } |
| } |
| |
| |
| public void AddShake(Vector3 point, float range, float strength, bool continous) |
| public void AddShake(Vector3 point, float range, float strength, bool continous) |
| { |
| { |
| if (!this.m_cameraShakeEnabled) |
| if (!this.m_cameraShakeEnabled) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| float num = Vector3.Distance(point, base.transform.position); |
| float num = Vector3.Distance(point, base.transform.position); |
| if (num > range) |
| if (num > range) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| num = Mathf.Max(1f, num); |
| num = Mathf.Max(1f, num); |
| float num2 = 1f - num / range; |
| float num2 = 1f - num / range; |
| float num3 = strength * num2; |
| float num3 = strength * num2; |
| if (num3 < this.m_shakeIntensity) |
| if (num3 < this.m_shakeIntensity) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| this.m_shakeIntensity = num3; |
| this.m_shakeIntensity = num3; |
| if (continous) |
| if (continous) |
| { |
| { |
| this.m_shakeTimer = Time.time * Mathf.Clamp01(strength) * this.m_shakeFreq; |
| this.m_shakeTimer = Time.time * Mathf.Clamp01(strength) * this.m_shakeFreq; |
| return; |
| return; |
| } |
| } |
| this.m_shakeTimer = Time.time * Mathf.Clamp01(this.m_shakeIntensity) * this.m_shakeFreq; |
| this.m_shakeTimer = Time.time * Mathf.Clamp01(this.m_shakeIntensity) * this.m_shakeFreq; |
| } |
| } |
| |
| |
| private float RayTest(Vector3 point, Vector3 dir, float maxDist) |
| private float RayTest(Vector3 point, Vector3 dir, float maxDist) |
| { |
| { |
| RaycastHit raycastHit; |
| RaycastHit raycastHit; |
| if (Physics.SphereCast(point, 0.2f, dir, out raycastHit, maxDist, this.m_blockCameraMask)) |
| if (Physics.SphereCast(point, 0.2f, dir, out raycastHit, maxDist, this.m_blockCameraMask)) |
| { |
| { |
| return raycastHit.distance; |
| return raycastHit.distance; |
| } |
| } |
| return maxDist; |
| return maxDist; |
| } |
| } |
| |
| |
| private Vector3 GetCameraBaseOffset(Player player) |
| private Vector3 GetCameraBaseOffset(Player player) |
| { |
| { |
| if (player.InBed()) |
| if (player.InBed()) |
| { |
| { |
| return player.GetHeadPoint() - player.transform.position; |
| return player.GetHeadPoint() - player.transform.position; |
| } |
| } |
| if (player.IsAttached() || player.IsSitting()) |
| if (player.IsAttached() || player.IsSitting()) |
| { |
| { |
| return player.GetHeadPoint() + Vector3.up * 0.3f - player.transform.position; |
| return player.GetHeadPoint() + Vector3.up * 0.3f - player.transform.position; |
| } |
| } |
| return player.m_eye.transform.position - player.transform.position; |
| return player.m_eye.transform.position - player.transform.position; |
| } |
| } |
| |
| |
| private void UpdateBaseOffset(Player player, float dt) |
| private void UpdateBaseOffset(Player player, float dt) |
| { |
| { |
| Vector3 cameraBaseOffset = this.GetCameraBaseOffset(player); |
| Vector3 cameraBaseOffset = this.GetCameraBaseOffset(player); |
| this.m_currentBaseOffset = Vector3.SmoothDamp(this.m_currentBaseOffset, cameraBaseOffset, ref this.m_offsetBaseVel, 0.5f, 999f, dt); |
| this.m_currentBaseOffset = Vector3.SmoothDamp(this.m_currentBaseOffset, cameraBaseOffset, ref this.m_offsetBaseVel, 0.5f, 999f, dt); |
| if (Vector3.Distance(this.m_playerPos, player.transform.position) > 20f) |
| if (Vector3.Distance(this.m_playerPos, player.transform.position) > 20f) |
| { |
| { |
| this.m_playerPos = player.transform.position; |
| this.m_playerPos = player.transform.position; |
| } |
| } |
| this.m_playerPos = Vector3.SmoothDamp(this.m_playerPos, player.transform.position, ref this.m_playerVel, this.m_smoothness, 999f, dt); |
| this.m_playerPos = Vector3.SmoothDamp(this.m_playerPos, player.transform.position, ref this.m_playerVel, this.m_smoothness, 999f, dt); |
| } |
| } |
| |
| |
| private Vector3 GetOffsetedEyePos() |
| private Vector3 GetOffsetedEyePos() |
| { |
| { |
| Player localPlayer = Player.m_localPlayer; |
| Player localPlayer = Player.m_localPlayer; |
| if (!localPlayer) |
| if (!localPlayer) |
| { |
| { |
| return base.transform.position; |
| return base.transform.position; |
| } |
| } |
| if (localPlayer.GetStandingOnShip() != null || localPlayer.IsAttached()) |
| if (localPlayer.GetStandingOnShip() != null || localPlayer.IsAttached()) |
| { |
| { |
| return localPlayer.transform.position + this.m_currentBaseOffset + this.GetCameraOffset(localPlayer); |
| return localPlayer.transform.position + this.m_currentBaseOffset + this.GetCameraOffset(localPlayer); |
| } |
| } |
| return this.m_playerPos + this.m_currentBaseOffset + this.GetCameraOffset(localPlayer); |
| return this.m_playerPos + this.m_currentBaseOffset + this.GetCameraOffset(localPlayer); |
| } |
| } |
| |
| |
| private Vector3 GetCameraOffset(Player player) |
| private Vector3 GetCameraOffset(Player player) |
| { |
| { |
| if (this.m_distance <= 0f) |
| if (this.m_distance <= 0f) |
| { |
| { |
| return player.m_eye.transform.TransformVector(this.m_fpsOffset); |
| return player.m_eye.transform.TransformVector(this.m_fpsOffset); |
| } |
| } |
| if (player.InBed()) |
| if (player.InBed()) |
| { |
| { |
| return Vector3.zero; |
| return Vector3.zero; |
| } |
| } |
| Vector3 vector = (player.UseMeleeCamera() ? this.m_3rdCombatOffset : this.m_3rdOffset); |
| Vector3 vector = (player.UseMeleeCamera() ? this.m_3rdCombatOffset : this.m_3rdOffset); |
| return player.m_eye.transform.TransformVector(vector); |
| return player.m_eye.transform.TransformVector(vector); |
| } |
| } |
| |
| |
| public void ToggleFreeFly() |
| public void ToggleFreeFly() |
| { |
| { |
| this.m_freeFly = !this.m_freeFly; |
| this.m_freeFly = !this.m_freeFly; |
| } |
| } |
| |
| |
| public void SetFreeFlySmoothness(float smooth) |
| public void SetFreeFlySmoothness(float smooth) |
| { |
| { |
| this.m_freeFlySmooth = Mathf.Clamp(smooth, 0f, 1f); |
| this.m_freeFlySmooth = Mathf.Clamp(smooth, 0f, 1f); |
| } |
| } |
| |
| |
| public float GetFreeFlySmoothness() |
| public float GetFreeFlySmoothness() |
| { |
| { |
| return this.m_freeFlySmooth; |
| return this.m_freeFlySmooth; |
| } |
| } |
| |
| |
| public static bool InFreeFly() |
| public static bool InFreeFly() |
| { |
| { |
| return GameCamera.m_instance && GameCamera.m_instance.m_freeFly; |
| return GameCamera.m_instance && GameCamera.m_instance.m_freeFly; |
| } |
| } |
| |
| |
| [CompilerGenerated] |
| [CompilerGenerated] |
| private float <UpdateCamera>g__debugCamera|9_0(float scroll) |
| private float <UpdateCamera>g__debugCamera|9_0(float scroll) |
| { |
| { |
| if (ZInput.GetKey(KeyCode.LeftShift, true) && ZInput.GetKey(KeyCode.C, true) && !global::Console.IsVisible()) |
| if (ZInput.GetKey(KeyCode.LeftShift, true) && ZInput.GetKey(KeyCode.C, true) && !global::Console.IsVisible()) |
| { |
| { |
| Vector2 mouseDelta = ZInput.GetMouseDelta(); |
| Vector2 mouseDelta = ZInput.GetMouseDelta(); |
| EnvMan.instance.m_debugTimeOfDay = true; |
| EnvMan.instance.m_debugTimeOfDay = true; |
| EnvMan.instance.m_debugTime = (EnvMan.instance.m_debugTime + mouseDelta.y * 0.005f) % 1f; |
| EnvMan.instance.m_debugTime = (EnvMan.instance.m_debugTime + mouseDelta.y * 0.005f) % 1f; |
| if (EnvMan.instance.m_debugTime < 0f) |
| if (EnvMan.instance.m_debugTime < 0f) |
| { |
| { |
| EnvMan.instance.m_debugTime += 1f; |
| EnvMan.instance.m_debugTime += 1f; |
| } |
| } |
| this.m_fov += mouseDelta.x * 1f; |
| this.m_fov += mouseDelta.x * 1f; |
| this.m_fov = Mathf.Clamp(this.m_fov, 0.5f, 165f); |
| this.m_fov = Mathf.Clamp(this.m_fov, 0.5f, 165f); |
| this.m_camera.fieldOfView = this.m_fov; |
| this.m_camera.fieldOfView = this.m_fov; |
| this.m_skyCamera.fieldOfView = this.m_fov; |
| this.m_skyCamera.fieldOfView = this.m_fov; |
| if (Player.m_localPlayer && Player.m_localPlayer.IsDebugFlying()) |
| if (Player.m_localPlayer && Player.m_localPlayer.IsDebugFlying()) |
| { |
| { |
| if (scroll > 0f) |
| if (scroll > 0f) |
| { |
| { |
| Character.m_debugFlySpeed = (int)Mathf.Clamp((float)Character.m_debugFlySpeed * 1.1f, (float)(Character.m_debugFlySpeed + 1), 300f); |
| Character.m_debugFlySpeed = (int)Mathf.Clamp((float)Character.m_debugFlySpeed * 1.1f, (float)(Character.m_debugFlySpeed + 1), 300f); |
| } |
| } |
| else if (scroll < 0f && Character.m_debugFlySpeed > 1) |
| else if (scroll < 0f && Character.m_debugFlySpeed > 1) |
| { |
| { |
| Character.m_debugFlySpeed = (int)Mathf.Min((float)Character.m_debugFlySpeed * 0.9f, (float)(Character.m_debugFlySpeed - 1)); |
| Character.m_debugFlySpeed = (int)Mathf.Min((float)Character.m_debugFlySpeed * 0.9f, (float)(Character.m_debugFlySpeed - 1)); |
| } |
| } |
| } |
| } |
| scroll = 0f; |
| scroll = 0f; |
| } |
| } |
| return scroll; |
| return scroll; |
| } |
| } |
| |
| |
| private Vector3 m_playerPos = Vector3.zero; |
| private Vector3 m_playerPos = Vector3.zero; |
| |
| |
| private Vector3 m_currentBaseOffset = Vector3.zero; |
| private Vector3 m_currentBaseOffset = Vector3.zero; |
| |
| |
| private Vector3 m_offsetBaseVel = Vector3.zero; |
| private Vector3 m_offsetBaseVel = Vector3.zero; |
| |
| |
| private Vector3 m_playerVel = Vector3.zero; |
| private Vector3 m_playerVel = Vector3.zero; |
| |
| |
| public Vector3 m_3rdOffset = Vector3.zero; |
| public Vector3 m_3rdOffset = Vector3.zero; |
| |
| |
| public Vector3 m_3rdCombatOffset = Vector3.zero; |
| public Vector3 m_3rdCombatOffset = Vector3.zero; |
| |
| |
| public Vector3 m_fpsOffset = Vector3.zero; |
| public Vector3 m_fpsOffset = Vector3.zero; |
| |
| |
| public float m_flyingDistance = 15f; |
| public float m_flyingDistance = 15f; |
| |
| |
| public LayerMask m_blockCameraMask; |
| public LayerMask m_blockCameraMask; |
| |
| |
| public float m_minDistance; |
| public float m_minDistance; |
| |
| |
| public float m_maxDistance = 6f; |
| public float m_maxDistance = 6f; |
| |
| |
| public float m_maxDistanceBoat = 6f; |
| public float m_maxDistanceBoat = 6f; |
| |
| |
| public float m_raycastWidth = 0.35f; |
| public float m_raycastWidth = 0.35f; |
| |
| |
| public bool m_smoothYTilt; |
| public bool m_smoothYTilt; |
| |
| |
| public float m_zoomSens = 10f; |
| public float m_zoomSens = 10f; |
| |
| |
| public float m_inventoryOffset = 0.1f; |
| public float m_inventoryOffset = 0.1f; |
| |
| |
| public float m_nearClipPlaneMin = 0.1f; |
| public float m_nearClipPlaneMin = 0.1f; |
| |
| |
| public float m_nearClipPlaneMax = 0.5f; |
| public float m_nearClipPlaneMax = 0.5f; |
| |
| |
| public float m_fov = 65f; |
| public float m_fov = 65f; |
| |
| |
| public float m_freeFlyMinFov = 5f; |
| public float m_freeFlyMinFov = 5f; |
| |
| |
| public float m_freeFlyMaxFov = 120f; |
| public float m_freeFlyMaxFov = 120f; |
| |
| |
| public float m_tiltSmoothnessShipMin = 0.1f; |
| public float m_tiltSmoothnessShipMin = 0.1f; |
| |
| |
| public float m_tiltSmoothnessShipMax = 0.5f; |
| public float m_tiltSmoothnessShipMax = 0.5f; |
| |
| |
| public float m_shakeFreq = 10f; |
| public float m_shakeFreq = 10f; |
| |
| |
| public float m_shakeMovement = 1f; |
| public float m_shakeMovement = 1f; |
| |
| |
| public float m_smoothness = 0.1f; |
| public float m_smoothness = 0.1f; |
| |
| |
| public float m_minWaterDistance = 0.3f; |
| public float m_minWaterDistance = 0.3f; |
| |
| |
| public Camera m_skyCamera; |
| public Camera m_skyCamera; |
| |
| |
| private float m_distance = 4f; |
| private float m_distance = 4f; |
| |
| |
| private bool m_freeFly; |
| private bool m_freeFly; |
| |
| |
| private float m_shakeIntensity; |
| private float m_shakeIntensity; |
| |
| |
| private float m_shakeTimer; |
| private float m_shakeTimer; |
| |
| |
| private bool m_cameraShakeEnabled = true; |
| private bool m_cameraShakeEnabled = true; |
| |
| |
| private bool m_mouseCapture; |
| private bool m_mouseCapture; |
| |
| |
| private Quaternion m_freeFlyRef = Quaternion.identity; |
| private Quaternion m_freeFlyRef = Quaternion.identity; |
| |
| |
| private float m_freeFlyYaw; |
| private float m_freeFlyYaw; |
| |
| |
| private float m_freeFlyPitch; |
| private float m_freeFlyPitch; |
| |
| |
| private float m_freeFlySpeed = 20f; |
| private float m_freeFlySpeed = 20f; |
| |
| |
| private float m_freeFlySmooth; |
| private float m_freeFlySmooth; |
| |
| |
| private Vector3 m_freeFlySavedVel = Vector3.zero; |
| private Vector3 m_freeFlySavedVel = Vector3.zero; |
| |
| |
| private Transform m_freeFlyTarget; |
| private Transform m_freeFlyTarget; |
| |
| |
| private Vector3 m_freeFlyTargetOffset = Vector3.zero; |
| private Vector3 m_freeFlyTargetOffset = Vector3.zero; |
| |
| |
| private Transform m_freeFlyLockon; |
| private Transform m_freeFlyLockon; |
| |
| |
| private Vector3 m_freeFlyLockonOffset = Vector3.zero; |
| private Vector3 m_freeFlyLockonOffset = Vector3.zero; |
| |
| |
| private Vector3 m_freeFlyVel = Vector3.zero; |
| private Vector3 m_freeFlyVel = Vector3.zero; |
| |
| |
| private Vector3 m_freeFlyAcc = Vector3.zero; |
| private Vector3 m_freeFlyAcc = Vector3.zero; |
| |
| |
| private Vector3 m_freeFlyTurnVel = Vector3.zero; |
| private Vector3 m_freeFlyTurnVel = Vector3.zero; |
| |
| |
| private bool m_shipCameraTilt = true; |
| private bool m_shipCameraTilt = true; |
| |
| |
| private Vector3 m_smoothedCameraUp = Vector3.up; |
| private Vector3 m_smoothedCameraUp = Vector3.up; |
| |
| |
| private Vector3 m_smoothedCameraUpVel = Vector3.zero; |
| private Vector3 m_smoothedCameraUpVel = Vector3.zero; |
| |
| |
| private AudioListener m_listner; |
| private AudioListener m_listner; |
| |
| |
| private Camera m_camera; |
| private Camera m_camera; |
| |
| |
| private bool m_waterClipping; |
| private bool m_waterClipping; |
| |
| |
| private bool m_camZoomToggle; |
| private bool m_camZoomToggle; |
| . | |
| |
| |
| public HeatDistortImageEffect m_heatDistortImageEffect; |
| |
| |
| private static GameCamera m_instance; |
| private static GameCamera m_instance; |
| } |
| } |
| |
| |