feat: Introduce DownCount feature with new models, scripts, textures, and a dedicated quiz scene.
This commit is contained in:
54
Assets/Quiz/Scripts/DownCount/LetterPoint.cs
Normal file
54
Assets/Quiz/Scripts/DownCount/LetterPoint.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
|
||||
using UdonSharp;
|
||||
using UnityEngine;
|
||||
using VRC.SDKBase;
|
||||
using VRC.Udon;
|
||||
|
||||
public class LetterPoint : UdonSharpBehaviour
|
||||
{
|
||||
LetterCard heldCard;
|
||||
|
||||
public void OnCardReleased(LetterCard card)
|
||||
{
|
||||
if (heldCard != null) return;
|
||||
heldCard = card;
|
||||
card.transform.position = this.transform.position;
|
||||
card.transform.rotation = this.transform.rotation;
|
||||
}
|
||||
|
||||
public void OnCardRemoved(LetterCard card)
|
||||
{
|
||||
if (heldCard == card)
|
||||
{
|
||||
heldCard = null;
|
||||
}
|
||||
}
|
||||
|
||||
void OnTriggerEnter(Collider other)
|
||||
{
|
||||
LetterCard card = other.GetComponent<LetterCard>();
|
||||
if (card != null)
|
||||
{
|
||||
card.currentPoint = this;
|
||||
}
|
||||
}
|
||||
|
||||
void OnTriggerExit(Collider other)
|
||||
{
|
||||
LetterCard card = other.GetComponent<LetterCard>();
|
||||
if (card != null)
|
||||
{
|
||||
// If the exiting card was the one we were holding, clear it
|
||||
if (card == heldCard)
|
||||
{
|
||||
heldCard = null;
|
||||
}
|
||||
|
||||
// Only clear if we are the one currently registered
|
||||
if (card.currentPoint == this)
|
||||
{
|
||||
card.currentPoint = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user