miepzerino
2025-03-30 d2ab30e7a69bfe7efda63ae75812207377917bd3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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