Heroes_of_Hiis/Assets/Project Files/Scripts/Helar/Inventory.cs

40 lines
1.0 KiB
C#

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.XR.Interaction.Toolkit;
[Serializable]
[RequireComponent(typeof(XRSocketInteractor))]
public class Inventory : MonoBehaviour
{
public int slots = 1;
private List<int> _inv;
private XRSocketInteractor xrSocketInteractor;
private void Awake()
{
xrSocketInteractor = GetComponent<XRSocketInteractor>();
_inv = new List<int>(slots);
var oldestInteractableSelected = xrSocketInteractor.GetOldestInteractableSelected();
xrSocketInteractor.selectEntered.AddListener(Call);
xrSocketInteractor.hoverEntered.AddListener(Call);
}
private void Call(HoverEnterEventArgs arg0)
{
Debug.Log("hoverenter "+arg0.interactableObject + " " + xrSocketInteractor.hasHover + " " + xrSocketInteractor.hasSelection);
}
private void Call(SelectEnterEventArgs arg0)
{
Debug.Log("selectenter "+arg0.interactableObject);
}
}