Cute_demon_attacks/meng_yao/Assets/script/A_Fight/gameGlobal.cs

65 lines
1.3 KiB
C#
Raw Normal View History

2024-12-09 18:01:59 +08:00
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;
/// <summary>
/// <20><>Ϸ<EFBFBD><CFB7>ʼ<EFBFBD><CABC>
/// </summary>
public static void GameInit()
{
Base.GlobalObj.GetComponent<gameGlobal>().OnGameInit?.Invoke();
}
/// <summary>
/// <20><>Ϸ<EFBFBD><CFB7><EFBFBD>Կ<EFBFBD>ʼ<><D7BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
/// </summary>
public static void GameStart()
{
Base.GlobalObj.GetComponent<gameGlobal>().OnGameStart?.Invoke();
}
/// <summary>
/// <20><>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD>
/// </summary>
public static void GamePlay()
{
Base.GlobalObj.GetComponent<gameGlobal>().OnGamePlay?.Invoke();
}
/// <summary>
/// <20><>Ϸ<EFBFBD><CFB7>ͣ
/// </summary>
public static void GameStop()
{
Time.timeScale = 0f;
}
/// <summary>
/// <20><>Ϸ<EFBFBD>ָ<EFBFBD>
/// </summary>
public static void GameRecovery()
{
Time.timeScale = 1f;
}
/// <summary>
/// <20><>Ϸ<EFBFBD>˳<EFBFBD>
/// </summary>
public static void GameExit()
{
Application.Quit();
// <20><><EFBFBD><EFBFBD><EFBFBD>ڱ༭<DAB1><E0BCAD><EFBFBD>в<EFBFBD><D0B2><EFBFBD><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>ϷЧ<CFB7><D0A7>
#if UNITY_EDITOR
UnityEditor.EditorApplication.isPlaying = false; // <20>ڱ༭<DAB1><E0BCAD><EFBFBD><EFBFBD>ֹͣ<CDA3><D6B9>Ϸ
#endif
}
}