mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 22:39:22 +00:00
26 lines
No EOL
679 B
C#
26 lines
No EOL
679 B
C#
using ABI_RC.Core.Util.Object_Behaviour;
|
|
using UnityEngine;
|
|
|
|
namespace NAK.DesktopVRSwitch.VRModeTrackers;
|
|
|
|
public class CameraFacingObjectTracker : MonoBehaviour
|
|
{
|
|
private CameraFacingObject _cameraFacingObject;
|
|
|
|
private void Start()
|
|
{
|
|
_cameraFacingObject = GetComponent<CameraFacingObject>();
|
|
VRModeSwitchManager.OnPostVRModeSwitch += OnPostSwitch;
|
|
}
|
|
|
|
private void OnDestroy()
|
|
{
|
|
VRModeSwitchManager.OnPostVRModeSwitch -= OnPostSwitch;
|
|
}
|
|
|
|
public void OnPostSwitch(bool intoVR)
|
|
{
|
|
// TODO: cache camera
|
|
_cameraFacingObject.m_Camera = Utils.GetPlayerCameraObject(intoVR).GetComponent<Camera>();
|
|
}
|
|
} |