Initial commit
This commit is contained in:
52
Assets/Scripts/ScoreBonusDisplay.cs
Normal file
52
Assets/Scripts/ScoreBonusDisplay.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
namespace Marro.PacManUdon
|
||||
{
|
||||
using UdonSharp;
|
||||
using UnityEngine;
|
||||
using VRC.SDKBase;
|
||||
using VRC.Udon;
|
||||
|
||||
public class ScoreBonusDisplay : UdonSharpBehaviour
|
||||
{
|
||||
private Animator animator;
|
||||
private float countdownSeconds;
|
||||
private bool countingDown;
|
||||
public void Initialize()
|
||||
{
|
||||
animator = GetComponent<Animator>();
|
||||
countdownSeconds = 0;
|
||||
countingDown = false;
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (countingDown)
|
||||
{
|
||||
countdownSeconds -= Time.deltaTime;
|
||||
if (countdownSeconds <= 0)
|
||||
{
|
||||
Hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void DisplayTemporarily(int score, int seconds)
|
||||
{
|
||||
Display(score);
|
||||
countdownSeconds = seconds;
|
||||
countingDown = true;
|
||||
}
|
||||
|
||||
public void Display(int score)
|
||||
{
|
||||
gameObject.SetActive(true);
|
||||
animator.SetFloat("Score", score);
|
||||
}
|
||||
|
||||
public void Hide()
|
||||
{
|
||||
countingDown = false;
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user