Partially implement lobby ui, fix ui pointers on network rig

This commit is contained in:
2024-09-09 16:31:08 +02:00
parent d7eb1e65d2
commit 8529ebb4a9
20 changed files with 4229 additions and 917 deletions

View File

@@ -1,5 +1,7 @@
using HurricaneVR.Framework.Components;
using HurricaneVR.Framework.ControllerInput;
using HurricaneVR.Framework.Core.Player;
using HurricaneVR.Framework.Core.UI;
using Meta.XR.MultiplayerBlocks.NGO;
using Sirenix.OdinInspector;
using System.Collections;
@@ -40,7 +42,7 @@ public class PlayerComponent : NetworkBehaviour
public Vector3 Position => controller.transform.position;
public Vector3 Rotation => controller.transform.eulerAngles;
public Vector3 Rotation => controller.Camera.forward;
private bool isSoloRig => !networkObject.IsPlayerObject;
private bool isMultiplayerLocalRig => networkObject.IsLocalPlayer;
@@ -67,6 +69,14 @@ public class PlayerComponent : NetworkBehaviour
{
StartCoroutine(AddDontDestroyToDependencies());
if (isSoloRig || isMultiplayerLocalRig)
{
foreach (var pointer in GetComponentsInChildren<HVRUIPointer>())
{
HVRInputModule.Instance.AddPointer(pointer);
}
}
if (!isSoloRig) return;
audioListener.enabled = true;

View File

@@ -6,19 +6,28 @@ using UnityEngine;
public class PlayerInputsCompoment : HVRPlayerInputs
{
protected bool EnableMouseLook;
protected bool EnableMouseLook = false;
protected override void UpdateInput()
{
base.UpdateInput();
EnableMouseLook = !Input.GetKey(KeyCode.LeftAlt);
if (Input.GetKey(KeyCode.LeftAlt))
{
EnableMouseLook = !EnableMouseLook;
}
}
protected override Vector2 GetMouse(out bool mouseDown)
{
mouseDown = EnableMouseLook;
return new Vector2(Input.GetAxis("Mouse X"), Input.GetAxis("Mouse Y"));
if (EnableMouseLook)
{
return new Vector2(Input.GetAxis("Mouse X"), Input.GetAxis("Mouse Y"));
}
return Vector2.zero;
}
protected override bool GetIsJumpActivated()