mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-03 14:59:23 +00:00
[DesktopVRSwitch] Testing
This commit is contained in:
parent
03514305be
commit
61a45f97bc
30 changed files with 957 additions and 524 deletions
34
DesktopVRSwitch/VRModeTrackers/CohtmlHudTracker.cs
Normal file
34
DesktopVRSwitch/VRModeTrackers/CohtmlHudTracker.cs
Normal file
|
@ -0,0 +1,34 @@
|
|||
using ABI_RC.Core.Player;
|
||||
using ABI_RC.Core.UI;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NAK.DesktopVRSwitch.VRModeTrackers;
|
||||
|
||||
public class CohtmlHudTracker : VRModeTracker
|
||||
{
|
||||
public override void TrackerInit()
|
||||
{
|
||||
VRModeSwitchManager.OnPostVRModeSwitch += OnPostSwitch;
|
||||
}
|
||||
|
||||
public override void TrackerDestroy()
|
||||
{
|
||||
VRModeSwitchManager.OnPostVRModeSwitch -= OnPostSwitch;
|
||||
}
|
||||
|
||||
private void OnPostSwitch(bool intoVR)
|
||||
{
|
||||
CohtmlHud _cohtmlHud = CohtmlHud.Instance;
|
||||
if (_cohtmlHud == null)
|
||||
{
|
||||
DesktopVRSwitch.Logger.Error("Error while getting CohtmlHud!");
|
||||
return;
|
||||
}
|
||||
DesktopVRSwitch.Logger.Msg("Configuring new hud affinity for CohtmlHud.");
|
||||
|
||||
_cohtmlHud.gameObject.transform.parent = intoVR ? PlayerSetup.Instance.vrCamera.transform : PlayerSetup.Instance.desktopCamera.transform;
|
||||
// This handles rotation and position
|
||||
ABI_RC.Core.CVRTools.ConfigureHudAffinity();
|
||||
_cohtmlHud.gameObject.transform.localScale = new Vector3(1.2f, 1f, 1.2f);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue