Пример #1
0
    /// <summary>
    /// client recieves player details message, update that player
    /// </summary>
    /// <param name="netMessage"> the recieved message</param>
    private void OnClientRecievePlayerDetails(NetworkMessage netMessage)
    {
        GamePlayerDetailsMessage playerDetailsMessage = netMessage.ReadMessage <GamePlayerDetailsMessage>();

        GameObject  targetPlayerObject = ClientScene.FindLocalObject(playerDetailsMessage.playerID);
        CustomLobby targetPlayer       = targetPlayerObject.GetComponent <CustomLobby>();

        targetPlayer.playerDetails = playerDetailsMessage.CreatePlayerDetails();
    }
Пример #2
0
    /// <summary>
    /// when the host recieves player details, update the player with them
    /// </summary>
    /// <param name="netMessage">the message with the details</param>
    private void OnHostRecievePlayerDetails(NetworkMessage netMessage)
    {
        GamePlayerDetailsMessage playerDetailsMessage = netMessage.ReadMessage <GamePlayerDetailsMessage>();

        GameObject  sendingPlayerObject = NetworkServer.FindLocalObject(playerDetailsMessage.playerID);
        CustomLobby sendingPlayer       = sendingPlayerObject.GetComponent <CustomLobby>();

        sendingPlayer.hasPlayerDetails = true;
        sendingPlayer.playerDetails    = playerDetailsMessage.CreatePlayerDetails();
    }