コード例 #1
0
    private void InnerGenerateLevelMessage(GenerateLevelMessage generateLevelMessage)
    {
        UIManager.Instance.ShowLevelLoadScreen(generateLevelMessage.reconnecting);
        DungeonDict.Instance.ClearRooms();

        MiniMapManager.Instance.OnLevelDeleted();

        RegionSceneLoader loader = RegionSceneLoader.Instance;

        new ExtendedCoroutine(this, loader.LoadScene(generateLevelMessage), loader.LoadLevel, true);
    }
コード例 #2
0
 private void OnGenerateLevelMessage(GenerateLevelMessage generateLevelMessage)
 {
     // We need to wait a frame if we are reconnecting. This is quite ugly but i dont know how else you
     // can delay code just a frame.
     if (generateLevelMessage.reconnecting == true)
     {
         StartCoroutine(GenerateLevelAfterFrame(generateLevelMessage));
     }
     else
     {
         InnerGenerateLevelMessage(generateLevelMessage);
     }
 }
コード例 #3
0
    private void JoinReconnect(NetworkConnection connection, Player oldPlayer)
    {
        NetworkServer.AddPlayerForConnection(connection, oldPlayer.gameObject);
        oldPlayer.playerId = connection.connectionId;

        StartGameMessage sgm = new StartGameMessage()
        {
            gameMode  = GameManager.gameMode,
            levelSeed = GameManager.gameMode.seed
        };

        connection.Send(sgm);

        GenerateLevelMessage glm = new GenerateLevelMessage()
        {
            levelNumber  = GameManager.currentLevel,
            reconnecting = true,
            region       = RegionDict.Instance.Region
        };

        connection.Send(glm);
    }
コード例 #4
0
 /// <summary>
 /// Loads new regions and unloads the old scenes.
 /// </summary>
 public IEnumerator LoadScene(GenerateLevelMessage generateLevelMessage)
 {
     this.generateLevelMessage = generateLevelMessage;
     yield return(LoadScene(generateLevelMessage.region));
 }
コード例 #5
0
    private IEnumerator GenerateLevelAfterFrame(GenerateLevelMessage generateLevelMessage)
    {
        yield return(null);

        InnerGenerateLevelMessage(generateLevelMessage);
    }