Ejemplo n.º 1
0
    public void InitGame(int index, List <LockStepPlayer> players, bool isDedicated = false)
    {
        allPlayers.Clear();
        foreach (LockStepPlayer player in players)
        {
            // Debug.Log("Init Game with Player : " + player.GetPlayerIndex());
            allPlayers[player.GetPlayerIndex()] = player;
        }
        _localPlayerIndex = index;
        _isDedicateServer = isDedicated;
        _numberOfPlayers  = players.Count;
        if (_numberOfPlayers == 0)
        {
            Debug.Log("Fatal Error! Incorrect number of players");
        }

        ResetGame();
        InitPlayersReadyState();
        if (_confirmedActions.IsConfirmedActionsEnabled())
        {
            _networkInterface.CallReadyToStart(_localPlayerIndex);
        }
        else
        {
            ReadyToStart(_localPlayerIndex);             // No confirmation, just start the game
        }
    }