// Token: 0x06000AE9 RID: 2793 RVA: 0x0004E798 File Offset: 0x0004C998 private void UpdateFreeFly(float dt) { if (global::Console.IsVisible()) { return; } Vector2 zero = Vector2.zero; zero.x = Input.GetAxis("Mouse X"); zero.y = Input.GetAxis("Mouse Y"); zero.x += ZInput.GetJoyRightStickX() * 110f * dt; zero.y += -ZInput.GetJoyRightStickY() * 110f * dt; this.m_freeFlyYaw += zero.x; this.m_freeFlyPitch -= zero.y; if (Input.GetAxis("Mouse ScrollWheel") < 0f) { this.m_freeFlySpeed *= 0.8f; } if (Input.GetAxis("Mouse ScrollWheel") > 0f) { this.m_freeFlySpeed *= 1.2f; } if (Input.GetAxis("Mouse ScrollWheel") > 0f) { this.m_freeFlySpeed *= 1.2f; } if (ZInput.GetButton("JoyTabLeft")) { this.m_camera.fieldOfView = Mathf.Max(this.m_freeFlyMinFov, this.m_camera.fieldOfView - dt * 20f); } if (ZInput.GetButton("JoyTabRight")) { this.m_camera.fieldOfView = Mathf.Min(this.m_freeFlyMaxFov, this.m_camera.fieldOfView + dt * 20f); } this.m_skyCamera.fieldOfView = this.m_camera.fieldOfView; if (ZInput.GetButton("JoyButtonY")) { this.m_freeFlySpeed += this.m_freeFlySpeed * 0.1f * dt * 10f; } if (ZInput.GetButton("JoyButtonX")) { this.m_freeFlySpeed -= this.m_freeFlySpeed * 0.1f * dt * 10f; } this.m_freeFlySpeed = Mathf.Clamp(this.m_freeFlySpeed, 1f, 1000f); if (ZInput.GetButtonDown("JoyLStick") || ZInput.GetButtonDown("SecondAttack")) { if (this.m_freeFlyLockon) { this.m_freeFlyLockon = null; } else { int mask = LayerMask.GetMask(new string[] { "Default", "static_solid", "terrain", "vehicle", "character", "piece", "character_net", "viewblock" }); RaycastHit raycastHit; if (Physics.Raycast(base.transform.position, base.transform.forward, out raycastHit, 10000f, mask)) { this.m_freeFlyLockon = raycastHit.collider.transform; this.m_freeFlyLockonOffset = this.m_freeFlyLockon.InverseTransformPoint(base.transform.position); } } } Vector3 vector = Vector3.zero; if (ZInput.GetButton("Left")) { vector -= Vector3.right; } if (ZInput.GetButton("Right")) { vector += Vector3.right; } if (ZInput.GetButton("Forward")) { vector += Vector3.forward; } if (ZInput.GetButton("Backward")) { vector -= Vector3.forward; } if (ZInput.GetButton("Jump")) { vector += Vector3.up; } if (ZInput.GetButton("Crouch")) { vector -= Vector3.up; } vector += Vector3.up * ZInput.GetJoyRTrigger(); vector -= Vector3.up * ZInput.GetJoyLTrigger(); vector += Vector3.right * ZInput.GetJoyLeftStickX(); vector += -Vector3.forward * ZInput.GetJoyLeftStickY(); if (ZInput.GetButtonDown("JoyButtonB") || ZInput.GetButtonDown("Block")) { this.m_freeFlySavedVel = vector; } float magnitude = this.m_freeFlySavedVel.magnitude; if (magnitude > 0.001f) { vector += this.m_freeFlySavedVel; if (vector.magnitude > magnitude) { vector = vector.normalized * magnitude; } } if (vector.magnitude > 1f) { vector.Normalize(); } vector = base.transform.TransformVector(vector); vector *= this.m_freeFlySpeed; if (this.m_freeFlySmooth <= 0f) { this.m_freeFlyVel = vector; } else { this.m_freeFlyVel = Vector3.SmoothDamp(this.m_freeFlyVel, vector, ref this.m_freeFlyAcc, this.m_freeFlySmooth, 99f, dt); } if (this.m_freeFlyLockon) { this.m_freeFlyLockonOffset += this.m_freeFlyLockon.InverseTransformVector(this.m_freeFlyVel * dt); base.transform.position = this.m_freeFlyLockon.TransformPoint(this.m_freeFlyLockonOffset); } else { 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); if (this.m_freeFlyLockon) { quaternion = this.m_freeFlyLockon.rotation * quaternion; } if (ZInput.GetButtonDown("JoyRStick") || ZInput.GetButtonDown("Attack")) { if (this.m_freeFlyTarget) { this.m_freeFlyTarget = null; } else { int mask2 = LayerMask.GetMask(new string[] { "Default", "static_solid", "terrain", "vehicle", "character", "piece", "character_net", "viewblock" }); RaycastHit raycastHit2; if (Physics.Raycast(base.transform.position, base.transform.forward, out raycastHit2, 10000f, mask2)) { this.m_freeFlyTarget = raycastHit2.collider.transform; this.m_freeFlyTargetOffset = this.m_freeFlyTarget.InverseTransformPoint(raycastHit2.point); } } } if (this.m_freeFlyTarget) { quaternion = Quaternion.LookRotation((this.m_freeFlyTarget.TransformPoint(this.m_freeFlyTargetOffset) - base.transform.position).normalized, Vector3.up); } if (this.m_freeFlySmooth <= 0f) { base.transform.rotation = quaternion; return; } Quaternion rotation = Utils.SmoothDamp(base.transform.rotation, quaternion, ref this.m_freeFlyRef, this.m_freeFlySmooth, 9999f, dt); base.transform.rotation = rotation; }