/// <summary> /// 游戏的循环协程 /// </summary> /// <returns></returns> private IEnumerator GameLoop() { yield return(StartCoroutine(RoundStarting())); //回合开始,有一段延时 GameRound.Instance.OnGameRoundStartEvent.Invoke(); yield return(StartCoroutine(RoundPlaying())); //回合中 GameRound.Instance.OnGameRoundEndEvent.Invoke(); yield return(StartCoroutine(RoundEnding())); //回合结束 // 如果结束了游戏,重新加载场景,否则进行下一回合 if (GameRound.Instance.IsEndOfTheGame()) { AllSceneManager.LoadScene(AllSceneManager.GameSceneType.SoloScene); } else { StartCoroutine(GameLoop()); } }
/// <summary> /// 回到主菜单 /// </summary> public void BackToMainScene() { StopAllCoroutines(); AllSceneManager.LoadScene(AllSceneManager.GameSceneType.MainMenuScene); }
/// <summary> /// 加载游戏大厅场景 /// </summary> public void LoadLobbyScene() { AllSceneManager.LoadScene(AllSceneManager.GameSceneType.LobbyScene); }
/// <summary> /// 加载单人模式场景 /// </summary> public void LoadSoloScene() { AllSceneManager.LoadScene(AllSceneManager.GameSceneType.SoloScene); }
/// <summary> /// 回到主菜单 /// </summary> public void BackToMainScene() { AllSceneManager.LoadScene(AllSceneManager.GameSceneType.MainMenuScene); }