增加怪物功能,调整灵灯参数

This commit is contained in:
2026-07-03 16:06:18 +08:00
parent e75868832f
commit 6e414a3022
46 changed files with 5907 additions and 300 deletions
+15 -3
View File
@@ -5,13 +5,16 @@ namespace GameFramework
{
/// <summary>
/// 全局游戏状态管理器(持久化单例)。
/// 维护 GameState,提供 GameOver 触发入口与 onGameOver 事件。
/// 维护 GameState,提供 GameOver / Win 触发入口与对应事件。
/// </summary>
public class GameManager : PersistentSingleton<GameManager>
{
/// <summary>游戏结束时触发GameOverScreen 等订阅)。</summary>
/// <summary>游戏结束(失败)时触发。</summary>
public static Action onGameOver;
/// <summary>游戏胜利时触发。</summary>
public static Action onGameWin;
public static GameState GameState
{
get => Instance.gameState;
@@ -20,13 +23,21 @@ namespace GameFramework
[SerializeField] private GameState gameState = GameState.Playing;
/// <summary>触发游戏结束:设状态 + 触发事件。玩家被敌人抓到时调用。</summary>
/// <summary>触发游戏失败:设状态 + 触发事件。</summary>
public static void GameOver()
{
if (Instance == null) return;
GameState = GameState.GameOver;
onGameOver?.Invoke();
}
/// <summary>触发游戏胜利:设状态 + 触发事件。</summary>
public static void Win()
{
if (Instance == null) return;
GameState = GameState.Victory;
onGameWin?.Invoke();
}
}
public enum GameState
@@ -34,6 +45,7 @@ namespace GameFramework
Playing,
Paused,
GameOver,
Victory,
Scoring
}
}