Files
PacManUdon/Assets/Scripts/ExtraLivesDisplay.cs
2025-12-10 21:06:22 +01:00

30 lines
1.0 KiB
C#

namespace Marro.PacManUdon
{
using UdonSharp;
using UnityEngine;
using VRC.SDKBase;
using VRC.Udon;
public class ExtraLivesDisplay : UdonSharpBehaviour
{
GameObject[] extraLifeIndicators;
public void Initialize()
{
Transform[] extraLifeIndicatorTransforms = transform.GetComponentsInChildren<Transform>();
extraLifeIndicators = new GameObject[extraLifeIndicatorTransforms.Length];
for (int i = 0; i < extraLifeIndicatorTransforms.Length; i++)
{
extraLifeIndicators[i] = extraLifeIndicatorTransforms[i].gameObject;
}
}
public bool SetExtraLives(int extraLives)
{
for (int extraLifeIndicatorIndex = 0; extraLifeIndicatorIndex < extraLifeIndicators.Length; extraLifeIndicatorIndex++)
{
extraLifeIndicators[extraLifeIndicatorIndex].SetActive(extraLifeIndicatorIndex < extraLives);
}
return true;
}
}
}