using System.Collections; using System.Collections.Generic; using UnityEngine; public class gameGlobal : Base { public delegate void GameItem(); public event GameItem OnGameInit; public event GameItem OnGameStart; public event GameItem OnGamePlay; public event GameItem OnGameVictory; public event GameItem OnGameOver; public List CarryCardId = new List(); /// /// 游戏初始化 /// public static void GameInit() { Base.GlobalObj.GetComponent().OnGameInit?.Invoke(); } /// /// 游戏可以开始,准备完成 /// public static void GameStart() { Base.GlobalObj.GetComponent().OnGameStart?.Invoke(); } /// /// 游戏进行 /// public static void GamePlay() { Debug.Log("游戏开始"); Base.GlobalObj.GetComponent().OnGamePlay?.Invoke(); } /// /// 游戏暂停 /// public static void GameStop() { Time.timeScale = 0f; } /// /// 游戏恢复 /// public static void GameRecovery() { Time.timeScale = 1f; } /// /// 游戏退出 /// public static void GameExit() { Application.Quit(); // 如果在编辑器中测试退出游戏效果 #if UNITY_EDITOR UnityEditor.EditorApplication.isPlaying = false; // 在编辑器中停止游戏 #endif } /// /// GameVictory /// public static void GameVictory() { Base.GlobalObj.GetComponent().OnGameVictory?.Invoke(); } /// /// GameVictory /// public static void GameOver() { Base.GlobalObj.GetComponent().OnGameOver?.Invoke(); } }