123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- using System;
- using UnityEngine;
- public class OvrUI : MonoBehaviour
- {
- private void Start()
- {
- this.m_qGui = Quaternion.Euler(0f, -180f, 0f);
- this.m_trOvrScr = UTY.GetChildObject(base.gameObject, "ovr_screen", false).transform;
- this.m_fDistanceLimitFar = (this.m_fDistanceNow = this.m_trOvrScr.localPosition.z);
- this.CalcAngleLimit();
- }
- private void CalcAngleLimit()
- {
- this.m_fDistanceParNow = this.m_fDistanceNow / this.m_fDistanceLimitFar;
- this.m_fAngleLimitNow = this.m_fAngleLimitNear + (this.m_fAngleLimitFar - this.m_fAngleLimitNear) * this.m_fDistanceParNow;
- }
- private void Update()
- {
- if (Input.GetKey(KeyCode.UpArrow))
- {
- this.m_fDistanceNow += 0.1f * Time.deltaTime;
- }
- if (Input.GetKey(KeyCode.DownArrow))
- {
- this.m_fDistanceNow -= 0.1f * Time.deltaTime;
- }
- if (this.m_fDistanceNow > this.m_fDistanceLimitFar)
- {
- this.m_fDistanceNow = this.m_fDistanceLimitFar;
- }
- else if (this.m_fDistanceNow < this.m_fDistanceLimitNear)
- {
- this.m_fDistanceNow = this.m_fDistanceLimitNear;
- }
- this.m_trOvrScr.localPosition = new Vector3(0f, 0f, this.m_fDistanceNow);
- this.CalcAngleLimit();
- Vector3 vector = Vector3.forward;
- Vector3 vector2 = Vector3.forward;
- vector = this.m_goCenter.transform.rotation * vector;
- vector2 = base.transform.rotation * vector2;
- float num = Vector3.Angle(vector2, vector);
- if (num > this.m_fAngleLimitNow)
- {
- this.m_qGui = Quaternion.Lerp(this.m_qGui, this.m_goCenter.transform.rotation, this.m_speed);
- }
- base.transform.rotation = this.m_qGui;
- CameraMain.FadeState fadeState = GameMain.Instance.MainCamera.GetFadeState();
- if (Input.GetKey(KeyCode.U) || (this.m_BefFadeState != fadeState && fadeState == CameraMain.FadeState.ProcIn))
- {
- base.transform.rotation = (this.m_qGui = this.m_goCenter.transform.rotation);
- }
- this.m_BefFadeState = fadeState;
- }
- public float m_speed = 0.05f;
- public float m_fAngleLimitFar = 40f;
- public float m_fAngleLimitNear = 90f;
- private float m_fAngleLimitNow = 40f;
- public float m_fDistanceLimitNear = 0.1f;
- private float m_fDistanceLimitFar = 0.4f;
- private float m_fDistanceNow = 0.4f;
- private float m_fDistanceParNow;
- public GameObject m_goCenter;
- private Quaternion m_qGui = Quaternion.identity;
- private Transform m_trOvrScr;
- private CameraMain.FadeState m_BefFadeState;
- }
|