using NaughtyAttributes;
using UnityEngine;

namespace EscapeRoomEngine.VR.Runtime
{
    /// <summary>
    /// The player component contains references to the main camera, eye positions and hand positions of the VR player.
    /// </summary>
    public class Player : MonoBehaviour
    {
        /// <summary>
        /// The active player instance.
        /// </summary>
        public static Player Instance { get; private set; }

        private void Awake()
        {
            Instance = this;
        }

        [BoxGroup("Internal")] public new Camera camera;
        [BoxGroup("Internal")] [SerializeField] private Transform leftEye, rightEye;
        [BoxGroup("Internal")] [SerializeField] private Collider leftHand, rightHand;

        public Transform GetEye(Camera.StereoscopicEye eye) =>
            eye == Camera.StereoscopicEye.Left ? leftEye : rightEye;
    }
}
