using Framework; using Gameplay.Pause; namespace Gameplay.Level { public static class ELevelSpeed { public static float Level_0 = 0f; public static float Level_1 = 1f; public static float Level_2 = 2f; public static float Level_3 = 4f; public static float DEFAULT_SPEED = 1F; } public partial class Level { private bool _isPause = false; private float _speed = ELevelSpeed.Level_1; public void SetPause(bool pause) { _isPause = pause; if (PauseManager.instance != null) { PauseManager.instance.globalScale = _isPause ? 0 : _speed; } EventManager.Instance.Send(EventManager.EventName.LevelFightUIPauseChange); } public void SetSpeed(float speed) { if (speed < 0) { DebugUtil.LogError("错误的速度值: {0}", speed); return; } _speed = speed; if (PauseManager.instance != null) { PauseManager.instance.globalScale = _isPause ? 0 : _speed; } EventManager.Instance.Send(EventManager.EventName.LevelSpeedChange); } public bool IsPause() { return _isPause; } public float GetSpeed() { return _speed; } public bool IsSpeed(float speed) { return _speed - speed < 0.01f && _speed - speed > -0.01f; } } }