From d2ab30e7a69bfe7efda63ae75812207377917bd3 Mon Sep 17 00:00:00 2001 From: miepzerino <o.skotnik@gmail.com> Date: Sun, 30 Mar 2025 18:50:27 +0000 Subject: [PATCH] Merge branch 'Flexalon-UI-Layouts' into develop --- Assets/Flexalon/Runtime/Interaction/FlexalonOculusInputProvider.cs | 32 ++++++++++++++++++++++++++++++++ 1 files changed, 32 insertions(+), 0 deletions(-) diff --git a/Assets/Flexalon/Runtime/Interaction/FlexalonOculusInputProvider.cs b/Assets/Flexalon/Runtime/Interaction/FlexalonOculusInputProvider.cs new file mode 100644 index 0000000..cf361ac --- /dev/null +++ b/Assets/Flexalon/Runtime/Interaction/FlexalonOculusInputProvider.cs @@ -0,0 +1,32 @@ +#if FLEXALON_OCULUS + +using Oculus.Interaction; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; + +namespace Flexalon +{ + public class FlexalonOculusInputProvider : MonoBehaviour, InputProvider + { + public InputMode InputMode => InputMode.External; + public bool Active => _states.Any(s => s == InteractableState.Select); + public Ray Ray => default; + public Vector3 UIPointer => default; + public GameObject ExternalFocusedObject => _states.Any(s => s == InteractableState.Hover || s == InteractableState.Select) ? gameObject : null; + + private IInteractable[] _interactables; + private IEnumerable<InteractableState> _states => _interactables.Select(i => i.State); + + public void Awake() + { + _interactables = GetComponents<IInteractable>(); + if (_interactables.Length == 0) + { + Debug.LogWarning("FlexalonOculusInputProvider should be placed next to Oculus Interactable component."); + } + } + } +} + +#endif \ No newline at end of file -- Gitblit v1.9.3