48 lines
944 B
C#
48 lines
944 B
C#
|
|
using UdonSharp;
|
|
using UnityEngine;
|
|
using VRC.SDKBase;
|
|
using VRC.Udon;
|
|
|
|
public class LetterCard : UdonSharpBehaviour
|
|
{
|
|
public TMPro.TextMeshProUGUI letterText;
|
|
[UdonSynced] public string currentLetter;
|
|
|
|
[HideInInspector] public LetterPoint currentPoint;
|
|
|
|
public override void OnDrop()
|
|
{
|
|
if (currentPoint != null)
|
|
{
|
|
currentPoint.OnCardReleased(this);
|
|
}
|
|
}
|
|
|
|
public override void OnPickup()
|
|
{
|
|
if (currentPoint != null)
|
|
{
|
|
currentPoint.OnCardRemoved(this);
|
|
}
|
|
}
|
|
|
|
public void SetLetter(string letter)
|
|
{
|
|
this.currentLetter = letter;
|
|
if (letterText != null)
|
|
{
|
|
letterText.text = currentLetter;
|
|
}
|
|
RequestSerialization();
|
|
}
|
|
|
|
public override void OnDeserialization()
|
|
{
|
|
if (letterText != null)
|
|
{
|
|
letterText.text = currentLetter;
|
|
}
|
|
}
|
|
}
|