12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- using Blue;
- using UnityEngine;
- public class ResetTransform : MonoBehaviour
- {
- public Transform Xunjian => SceneIOCContainer.Instance.Pull("Dof") as Transform;
- public bool FixedHeight;
- private float height;
- private bool heightIsNull;
- private void Awake()
- {
- if(OpenXRCamera.Instance!=null)
- height = OpenXRCamera.Instance.head.position.y;
- else
- heightIsNull = true;
- }
- private void Start()
- {
- if(heightIsNull)
- height = OpenXRCamera.Instance.head.position.y;
- }
- public void Execute()
- {
- transform.position = Xunjian.position;
- transform.eulerAngles = Xunjian.eulerAngles;
-
- }
- public void FixedHeightExecute()
- {
- Vector3 v3 = Xunjian.position;
- v3.y = height;
- transform.position = v3;
- Vector3 v3Rot = Xunjian.eulerAngles;
- v3Rot = new Vector3(0, v3Rot.y, 0);
- transform.eulerAngles = v3Rot;
- }
- }
|