Exemple #1
0
    protected override GameObject StartPlayer(NetPlayer netPlayer, object data)
    {
        playerScript player = null;

        if (_existingSessions.TryGetValue(netPlayer.GetSessionId(), out player))
        {
            player.reinitialize(netPlayer);
            return(player.gameObject);
        }
        else
        {
            GameObject newPlayerGO = base.StartPlayer(netPlayer, data);
            _existingSessions.Add(netPlayer.GetSessionId(), newPlayerGO.GetComponent <playerScript>());
            return(newPlayerGO);
        }
    }