技能主要更新,修复卡顿并加入动画,以及各种其他更新。
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using UnityEngine;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using UnityEngine.SceneManagement;
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditor;
|
||||
@@ -19,7 +20,7 @@ public class PauseManager : MonoBehaviour
|
||||
|
||||
public bool IsPaused { get; private set; } = false;
|
||||
|
||||
// 添加暂停状态改变事件
|
||||
// ������ͣ״̬�ı��¼�
|
||||
public event Action<bool> OnPauseStateChanged;
|
||||
|
||||
void Awake()
|
||||
@@ -52,13 +53,13 @@ public class PauseManager : MonoBehaviour
|
||||
TogglePause();
|
||||
}
|
||||
|
||||
// 当处于暂停状态且按下 Backspace 时返回主界面
|
||||
// ��������ͣ״̬�Ұ��� Backspace ʱ����������
|
||||
if (IsPaused && Input.GetKeyDown(KeyCode.Backspace))
|
||||
{
|
||||
// 恢复时间流并触发事件,然后加载主场景
|
||||
// �ָ�ʱ�����������¼���Ȼ�����������
|
||||
Pause(false);
|
||||
// 确保场景名称与项目中的主场景匹配
|
||||
SceneManager.LoadScene("Main_main");
|
||||
// ȷ��������������Ŀ�е�������ƥ��
|
||||
StartCoroutine(LoadSceneAsync("Main_main"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,4 +91,13 @@ public class PauseManager : MonoBehaviour
|
||||
{
|
||||
Pause(!IsPaused);
|
||||
}
|
||||
|
||||
private IEnumerator LoadSceneAsync(string sceneName)
|
||||
{
|
||||
AsyncOperation asyncLoad = SceneManager.LoadSceneAsync(sceneName);
|
||||
while (!asyncLoad.isDone)
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user