계산대 로직 중간저장
This commit is contained in:
25
Assets/02_Scripts/UI/CheckoutVRButton.cs
Normal file
25
Assets/02_Scripts/UI/CheckoutVRButton.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.XR.Interaction.Toolkit.UI;
|
||||
using VRShopping.Interact;
|
||||
|
||||
public class CheckoutVRButton : MonoBehaviour, IPointerClickHandler
|
||||
{
|
||||
public void OnPointerClick(PointerEventData eventData)
|
||||
{
|
||||
GameObject whatWasClicked = eventData.pointerPress;
|
||||
|
||||
if (eventData is not TrackedDeviceEventData trackedData) return;
|
||||
|
||||
var interactorMB = trackedData.interactor as MonoBehaviour;
|
||||
if (interactorMB == null) return;
|
||||
GameObject whoClicked = interactorMB.gameObject;
|
||||
|
||||
PlayerController clickPlayer = whoClicked.GetComponentInParent<PlayerController>();
|
||||
CheckoutMachine checkoutMachine = whatWasClicked.GetComponentInParent<CheckoutMachine>();
|
||||
|
||||
if (clickPlayer == null || checkoutMachine == null) return;
|
||||
|
||||
clickPlayer.Checkout(checkoutMachine);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user