using System; using UnityEngine; using UnityEngine.UI; using Interface; using Core; using Gameplay.Player; namespace Gameplay { public class CardViewer : MonoBehaviour, IInteractable { public Card Card; [SerializeField] private MeshRenderer frontMeshRenderer; [SerializeField] private MeshRenderer backMeshRenderer; [SerializeField] private Text cardNameText; [SerializeField] private Text cardDescriptionText; private PlayerController _playerController; private void Start() { ControllerLocator.Instance.TryGet(out _playerController); } public void SetCard(Card card) { Card = card; if (frontMeshRenderer != null && card.FrontTexture != null) { frontMeshRenderer.material.mainTexture = card.FrontTexture; } if (backMeshRenderer != null && card.BackTexture != null) { backMeshRenderer.material.mainTexture = card.BackTexture; } cardNameText.text = card.CardName; cardDescriptionText.text = card.CardDescription; } public string GetInteractPrompt() { return ""; } public void Interact(GameObject interactor) { } public void OnGazeEnter(GameObject editor) { if(_playerController != null) _playerController.playerCardsController.StopRotatingCards(); } public void OnGazeExit(GameObject editor) { if (_playerController != null) _playerController.playerCardsController.StartRotatingCards(); } } }