添加场景、对应场景代码

This commit is contained in:
JA
2026-06-30 09:46:59 +08:00
parent eeb1907247
commit 1489f33d9d
41 changed files with 3685 additions and 9 deletions
+39
View File
@@ -0,0 +1,39 @@
using System;
using UnityEngine;
namespace GameFramework
{
/// <summary>
/// 全局游戏状态管理器(持久化单例)。
/// 维护 GameState,提供 GameOver 触发入口与 onGameOver 事件。
/// </summary>
public class GameManager : PersistentSingleton<GameManager>
{
/// <summary>游戏结束时触发(GameOverScreen 等订阅)。</summary>
public static Action onGameOver;
public static GameState GameState
{
get => Instance.gameState;
set => Instance.gameState = value;
}
[SerializeField] private GameState gameState = GameState.Playing;
/// <summary>触发游戏结束:设状态 + 触发事件。玩家被敌人抓到时调用。</summary>
public static void GameOver()
{
if (Instance == null) return;
GameState = GameState.GameOver;
onGameOver?.Invoke();
}
}
public enum GameState
{
Playing,
Paused,
GameOver,
Scoring
}
}