2025-10-14 12:39:53 +08:00
|
|
|
|
|
|
|
|
using System;
|
2025-10-27 22:13:55 +08:00
|
|
|
using System.Collections;
|
2025-10-26 09:56:23 +08:00
|
|
|
using Core;
|
2025-10-27 22:13:55 +08:00
|
|
|
using UnityEngine;
|
|
|
|
|
|
2025-10-26 09:56:23 +08:00
|
|
|
namespace Script.Gameplay.Global
|
2025-10-14 12:39:53 +08:00
|
|
|
{
|
|
|
|
|
public class GameManager : MonoSingleton<GameManager>
|
|
|
|
|
{
|
2025-10-26 09:32:28 +08:00
|
|
|
public event Action OnGameStart;
|
2025-10-27 10:31:01 +08:00
|
|
|
private string currentStartGameMode = "Level1";
|
2025-10-14 12:39:53 +08:00
|
|
|
private void Start()
|
|
|
|
|
{
|
|
|
|
|
ScenesManager.Instance.LoadMainMenu();
|
|
|
|
|
}
|
2025-10-18 15:41:43 +08:00
|
|
|
|
2025-10-26 09:56:23 +08:00
|
|
|
public void StartGameplay()
|
2025-10-18 15:41:43 +08:00
|
|
|
{
|
|
|
|
|
ScenesManager.Instance.LoadGameplay("Level1");
|
2025-10-27 10:31:01 +08:00
|
|
|
currentStartGameMode = "Level1";
|
2025-10-26 09:32:28 +08:00
|
|
|
OnGameStart?.Invoke();
|
2025-10-18 15:41:43 +08:00
|
|
|
}
|
2025-10-26 09:56:23 +08:00
|
|
|
|
|
|
|
|
public void StartTest()
|
|
|
|
|
{
|
|
|
|
|
ScenesManager.Instance.LoadGameplay("Test");
|
2025-10-27 10:31:01 +08:00
|
|
|
currentStartGameMode = "Test";
|
|
|
|
|
OnGameStart?.Invoke();
|
|
|
|
|
}
|
|
|
|
|
|
2025-10-27 22:13:55 +08:00
|
|
|
public IEnumerator ReStartGame()
|
2025-10-27 10:31:01 +08:00
|
|
|
{
|
2025-10-27 22:13:55 +08:00
|
|
|
StartCoroutine(ScreenGlitchManager.Instance.TriggerGlitchEffect());
|
|
|
|
|
yield return new WaitForSeconds(1.0f);
|
2025-10-27 10:31:01 +08:00
|
|
|
ScenesManager.Instance.LoadGameplay(currentStartGameMode);
|
2025-10-26 09:56:23 +08:00
|
|
|
OnGameStart?.Invoke();
|
|
|
|
|
}
|
2025-10-14 12:39:53 +08:00
|
|
|
}
|
|
|
|
|
}
|