Initial commit
This commit is contained in:
30
Assets/Scripts/ExtraLivesDisplay.cs
Normal file
30
Assets/Scripts/ExtraLivesDisplay.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user