예제 #1
0
    /// <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());
        }
    }
예제 #2
0
 /// <summary>
 /// 回到主菜单
 /// </summary>
 public void BackToMainScene()
 {
     StopAllCoroutines();
     AllSceneManager.LoadScene(AllSceneManager.GameSceneType.MainMenuScene);
 }
예제 #3
0
 /// <summary>
 /// 加载游戏大厅场景
 /// </summary>
 public void LoadLobbyScene()
 {
     AllSceneManager.LoadScene(AllSceneManager.GameSceneType.LobbyScene);
 }
예제 #4
0
 /// <summary>
 /// 加载单人模式场景
 /// </summary>
 public void LoadSoloScene()
 {
     AllSceneManager.LoadScene(AllSceneManager.GameSceneType.SoloScene);
 }
예제 #5
0
 /// <summary>
 /// 回到主菜单
 /// </summary>
 public void BackToMainScene()
 {
     AllSceneManager.LoadScene(AllSceneManager.GameSceneType.MainMenuScene);
 }