WXMC/proj/unity/Assets/Scripts/WishCard.cs
2024-12-04 16:18:46 +08:00

69 lines
1.5 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using TMPro;
using System;
public class WishCard : MonoBehaviour
{
public GameObject CardFront;
public Button CardReturnButton;
public Button CardQuestionButton;
public TMP_Text CardFrontText;
public SpriteRenderer CardBackSprite;
public SpriteRenderer CardFrontSprite;
public List<WishCard> CollidingEmptySlotCards = new List<WishCard>();
public WishCard SlotInCard;
public WishCard SlotOfCard;
[SerializeField]
private bool m_isSlot = false;
public bool isSlot
{
get
{
return m_isSlot;
}
set
{
m_isSlot = value;
//GetComponent<Collider2D>().enabled = !m_isSlot;
}
}
public string name;
public string description;
public string main_representation;
public string advice;
// Start is called before the first frame update
void Start()
{
//GetComponent<Collider2D>().enabled = !isSlot;
}
private void OnTriggerEnter2D(Collider2D collision)
{
WishCard card = collision.GetComponent<WishCard>();
if (card != null && card.isSlot && card.SlotOfCard == null)
{
CollidingEmptySlotCards.Add(card);
}
}
private void OnTriggerExit2D(Collider2D collision)
{
WishCard card = collision.GetComponent<WishCard>();
if (card != null && card.isSlot)
{
CollidingEmptySlotCards.Remove(card);
}
}
}