2025-10-18 10:06:12 +08:00
|
|
|
using System;
|
2025-10-24 16:08:37 +08:00
|
|
|
using System.Collections;
|
2025-10-18 10:06:12 +08:00
|
|
|
using Core;
|
2025-10-18 15:41:43 +08:00
|
|
|
using Script.Gameplay.Input;
|
2025-10-18 10:06:12 +08:00
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
namespace Script.Gameplay.Global
|
|
|
|
|
{
|
|
|
|
|
public enum GameState
|
|
|
|
|
{
|
2025-10-20 09:34:22 +08:00
|
|
|
Boot, // 初始化
|
|
|
|
|
MainMenu, // 主菜单
|
|
|
|
|
Playing, // 游戏中
|
|
|
|
|
Paused, // 暂停
|
|
|
|
|
GameOver, // 游戏结束
|
|
|
|
|
Victory // 胜利
|
2025-10-18 10:06:12 +08:00
|
|
|
}
|
2025-10-20 09:34:22 +08:00
|
|
|
|
2025-10-18 10:06:12 +08:00
|
|
|
public class GameFlowManager : MonoSingleton<GameFlowManager>
|
|
|
|
|
{
|
2025-10-20 09:34:22 +08:00
|
|
|
public bool IsOpenRestartGameOnCountdownFinish = true;
|
2025-10-26 09:32:28 +08:00
|
|
|
private GameCountdownManager _gameCountdownManager;
|
2025-10-18 10:06:12 +08:00
|
|
|
private void Start()
|
|
|
|
|
{
|
2025-10-26 09:32:28 +08:00
|
|
|
_gameCountdownManager = GameCountdownManager.Instance;
|
2025-10-26 09:56:23 +08:00
|
|
|
GameManager.Instance.OnGameStart += OnGameStart;
|
2025-10-26 09:32:28 +08:00
|
|
|
_gameCountdownManager.OnFinish.AddListener(() =>
|
2025-10-20 09:34:22 +08:00
|
|
|
{
|
2025-10-24 16:08:37 +08:00
|
|
|
if (IsOpenRestartGameOnCountdownFinish)
|
2025-10-26 09:32:28 +08:00
|
|
|
StartCoroutine(OnCountDown());
|
2025-10-20 09:34:22 +08:00
|
|
|
}
|
|
|
|
|
);
|
2025-10-18 10:06:12 +08:00
|
|
|
}
|
2025-10-18 15:41:43 +08:00
|
|
|
|
2025-10-26 09:56:23 +08:00
|
|
|
public void OnGameStart()
|
|
|
|
|
{
|
|
|
|
|
_gameCountdownManager.StartLevelTimer();
|
|
|
|
|
}
|
|
|
|
|
|
2025-10-26 09:32:28 +08:00
|
|
|
public IEnumerator OnCountDown()
|
2025-10-18 15:41:43 +08:00
|
|
|
{
|
2025-10-24 16:08:37 +08:00
|
|
|
StartCoroutine(ScreenGlitchManager.Instance.TriggerGlitchEffect());
|
|
|
|
|
yield return new WaitForSeconds(1.0f);
|
2025-10-26 09:56:23 +08:00
|
|
|
GameManager.Instance.StartGameplay();
|
2025-10-18 15:41:43 +08:00
|
|
|
}
|
2025-10-18 10:06:12 +08:00
|
|
|
}
|
|
|
|
|
}
|