TO SQUASH: Changes.

This commit is contained in:
2026-07-18 23:30:43 -04:00
parent e0c95e192b
commit c7bc76ce98
32 changed files with 3123 additions and 192 deletions
+56
View File
@@ -0,0 +1,56 @@
using UnityEngine;
using System.Collections;
public class ScoreChecker : MonoBehaviour
{
public AudioSource winSound;
public AudioSource loseSound;
public Fader fadeOut;
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
}
// Update is called once per frame
void Update()
{
}
public void resetFader()
{
Invoke(nameof(checkScore), 0.5f);
}
private IEnumerator PlayAudioThenActivateGameObject(AudioSource audio, bool showGui)
{
audio.Play();
if (showGui) {
// Activate your GUI here
} else {
yield return new WaitUntil(() => audio.time >= audio.clip.length);
fadeOut.resetFader();
}
}
void checkScore()
{
int currentScore = PlayerPrefs.GetInt("CurrentScore");
AudioSource audio = null;
bool showGui = false;
if (GameSetup.IsHighScore(currentScore)) {
audio = winSound;
showGui = true;
} else {
audio = loseSound;
}
StartCoroutine(PlayAudioThenActivateGameObject(audio, showGui));
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: c7d837793868a819eb438a6336078dd7