feat():大改前的提交,这个版本保存了所有冗余的代码
This commit is contained in:
@@ -1,23 +1,62 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using Interface;
|
||||
using Core;
|
||||
using Gameplay.Player;
|
||||
|
||||
namespace Gameplay
|
||||
{
|
||||
public class CardViewer : MonoBehaviour
|
||||
public class CardViewer : MonoBehaviour, IInteractable
|
||||
{
|
||||
public Card Card;
|
||||
|
||||
[SerializeField] private MeshRenderer meshRenderer;
|
||||
|
||||
[SerializeField] private MeshRenderer frontMeshRenderer;
|
||||
[SerializeField] private MeshRenderer backMeshRenderer;
|
||||
[SerializeField] private Text cardNameText;
|
||||
[SerializeField] private Text cardDescriptionText;
|
||||
|
||||
public void Setup(Card card)
|
||||
|
||||
private PlayerController _playerController;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
ControllerLocator.Instance.TryGet<PlayerController>(out _playerController);
|
||||
}
|
||||
|
||||
public void SetCard(Card card)
|
||||
{
|
||||
Card = card;
|
||||
meshRenderer.material.mainTexture = card.Texture;
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user