VR兼容性代码

This commit is contained in:
shenjianxing 2025-03-26 11:39:49 +08:00
parent a43d36b9a0
commit bbcf0f96d9
2 changed files with 15 additions and 0 deletions

View File

@ -19,3 +19,9 @@ struct OnLock
{ {
public bool isLock; public bool isLock;
} }
struct OnUpdatePos
{
public Vector3 pos;
public Vector3 rot;
}

View File

@ -53,6 +53,12 @@ public class Show3DCamera : MonoBehaviour
TypeEventSystem.Global.Register<OnLock>(OnLockEvent).UnRegisterWhenDisabled(this); TypeEventSystem.Global.Register<OnLock>(OnLockEvent).UnRegisterWhenDisabled(this);
} }
private void OnEnable()
{
#if Turing
gameObject.SetActive(false);
#endif
}
private void OnLockEvent(OnLock islock) private void OnLockEvent(OnLock islock)
{ {
this.lockMove = islock.isLock; this.lockMove = islock.isLock;
@ -441,6 +447,9 @@ public class Show3DCamera : MonoBehaviour
// 相机始终朝向目标点 // 相机始终朝向目标点
transform.LookAt(targetPos); transform.LookAt(targetPos);
} }
#if Turing
TypeEventSystem.Global.Send<OnUpdatePos>(new OnUpdatePos() { pos = gameObject.Position(), rot = gameObject.LocalEulerAngles() });
#endif
} }
} }