Update
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using System.Collections;
|
||||
using Hallucinate.Audio; // Import namespace for AudioManager
|
||||
|
||||
public class FinishGate : MonoBehaviour
|
||||
{
|
||||
@@ -18,6 +19,11 @@ public class FinishGate : MonoBehaviour
|
||||
public GameObject winStar2;
|
||||
public GameObject winStar3;
|
||||
|
||||
[Header("Cài đặt Âm thanh")]
|
||||
public string winSound = "UI_Win";
|
||||
public string warningSound = "UI_Warning";
|
||||
public string clickSound = "UI_Click";
|
||||
|
||||
private void Start()
|
||||
{
|
||||
Time.timeScale = 1f;
|
||||
@@ -76,6 +82,8 @@ public class FinishGate : MonoBehaviour
|
||||
winPanel.SetActive(true);
|
||||
UpdateWinStarsUI(count); // Hiện số sao tương ứng trên bảng kết thúc
|
||||
}
|
||||
|
||||
AudioManager.PlayGlobal(winSound); // Chạy âm thanh thắng cuộc
|
||||
|
||||
Time.timeScale = 0f;
|
||||
Cursor.lockState = CursorLockMode.None;
|
||||
@@ -86,18 +94,23 @@ public class FinishGate : MonoBehaviour
|
||||
{
|
||||
if (ui == null) yield break;
|
||||
ui.SetActive(true);
|
||||
|
||||
if (ui == warningUI) AudioManager.PlayGlobal(warningSound); // Chạy âm thanh cảnh báo
|
||||
|
||||
yield return new WaitForSeconds(3f);
|
||||
ui.SetActive(false);
|
||||
}
|
||||
|
||||
public void RestartGame()
|
||||
{
|
||||
AudioManager.PlayGlobal(clickSound); // Âm thanh click nút
|
||||
Time.timeScale = 1f;
|
||||
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
|
||||
}
|
||||
|
||||
public void QuitGame()
|
||||
{
|
||||
AudioManager.PlayGlobal(clickSound); // Âm thanh click nút
|
||||
Application.Quit();
|
||||
#if UNITY_EDITOR
|
||||
UnityEditor.EditorApplication.isPlaying = false;
|
||||
|
||||
Reference in New Issue
Block a user