private void OnReceivePlayerMovementMessage(NetworkMessage _message)
    {
        Debug.Log("OnReceivePlayerMovementMessage");
        PlayerMovementMessage _msg = _message.ReadMessage <PlayerMovementMessage>();

        NetworkServer.SendToAll(movement_msg, _msg);
    }
Exemple #2
0
    private void OnReceiveMovementMessage(NetworkMessage _message)
    {
        PlayerMovementMessage _msg = _message.ReadMessage <PlayerMovementMessage>();

        if (_msg.objectTransformName != transform.name)
        {
            Manager.Instance.ConnectedPlayers[_msg.objectTransformName].GetComponent <NetworkPlayer>().ReceiveMovementMessage(_msg.objectPosition, _msg.objectRotation, _msg.time);
        }
    }
Exemple #3
0
    //recebe do servidor movement dos outros players
    private void OnReceivePlayerMovementMessage(NetworkMessage _message)
    {
        PlayerMovementMessage _msg = _message.ReadMessage <PlayerMovementMessage>();

        //verifica se a mensagem NAO e sobre o proprio jogador
        if (_msg.objectTransformName != transform.name)
        {
            //aceder ao player unit de quem enviou a mensagem e atualizar os valores desse jogador
            Manager.Instance.ConnectedPlayers[_msg.objectTransformName].GetComponent <NetworkPlayer>().ProcessPlayerMovementMessage(_msg.objectPosition, _msg.objectRotation, _msg.time);
        }
    }
Exemple #4
0
    public void SendMovementMessage(string _playerID, Vector3 _position, Quaternion _rotation, float _timeTolerp)
    {
        PlayerMovementMessage _msg = new PlayerMovementMessage()
        {
            objectPosition      = _position,
            objectRotation      = _rotation,
            objectTransformName = _playerID,
            time = _timeTolerp
        };

        NetworkManager.singleton.client.Send(movement_msg, _msg);
    }
    private void OnReceiveMovementMessage(NetworkMessage _message)
    {
        PlayerMovementMessage _msg = _message.ReadMessage <PlayerMovementMessage>();

        if (_msg.objectTransformName != transform.name)
        {
            Manager.Instance.ConnectedPlayers[_msg.objectTransformName]
            .GetComponent <NetworkPlayerVR>().ReceiveMovementMessage(_msg.headPosition, _msg.leftHandPosition, _msg.rightHandPosition
                                                                     , _msg.headRotation, _msg.leftHandRotation, _msg.rightHandRotation
                                                                     , _msg.leftTriggerLocalRotationY, _msg.rightTriggerLocalRotationY, _msg.time);
        }
    }
Exemple #6
0
    private void OnServerReceiveMovementMessage(NetworkMessage _message)
    {
        uint returnTo = _message.reader.Position;

        PlayerMovementMessage _msg = _message.ReadMessage <PlayerMovementMessage>();

        ReturnReaderTo(returnTo, _message.reader);

        foreach (NetworkConnection conn in NetworkServer.connections)
        {
            int   currentId   = conn.connectionId;
            short messageType = GetServerToClientMessageNumber(currentId);

            NetworkServer.SendToClient(currentId, messageType, _msg);

            //conn.Send(GetServerToClientMessageNumber(currentId), );
        }

        //NetworkServer.SendToAll(serverToClientMessageNumber, _msg);
    }
    public void SendMovementMessage(string _playerID, Vector3 _hPosition, Vector3 _lhPosition, Vector3 _rhPosition,
                                    Quaternion _hRotation, Quaternion _lhRotation, Quaternion _rhRotation,
                                    float _ltRotationY, float _rtRotationY,
                                    float _timeToLerp)
    {
        PlayerMovementMessage _msg = new PlayerMovementMessage()
        {
            objectTransformName        = _playerID,
            headPosition               = _hPosition,
            leftHandPosition           = _lhPosition,
            rightHandPosition          = _rhPosition,
            headRotation               = _hRotation,
            leftHandRotation           = _lhRotation,
            rightHandRotation          = _rhRotation,
            leftTriggerLocalRotationY  = _ltRotationY,
            rightTriggerLocalRotationY = _rtRotationY,
            time = _timeToLerp
        };

        NetworkManager.singleton.client.Send(movement_msg, _msg);
    }
Exemple #8
0
    private void OnPlayerReceiveMovementMessage(NetworkMessage _message)
    {
        PlayerMovementMessage _msg = _message.ReadMessage <PlayerMovementMessage>();

        if (_msg.objectTransformName == "Ball" && !ball.hasAuthority)
        {
            ReceiveBallMessage(_msg.objectPosition, _msg.objectRotation, _msg.time);
        }
        if (_msg.objectTransformName != transform.name && _msg.objectTransformName != "Ball")
        {
            if (!Manager.Instance.ConnectedPlayers.Keys.Contains(_msg.objectTransformName))
            {
                foreach (GameObject player in Manager.Instance.ConnectedPlayers.Values)
                {
                    CmdDebugLogging(player.name);
                }

                CmdDebugLogging(_msg.objectTransformName);
            }

            Manager.Instance.ConnectedPlayers[_msg.objectTransformName].GetComponent <NetworkPlayer>().ReceiveMovementMessage(_msg.objectPosition, _msg.objectRotation, _msg.time);
        }
    }
Exemple #9
0
    private void SendPlayerMovement(NetworkMessage _message)
    {
        PlayerMovementMessage _msg = _message.ReadMessage <PlayerMovementMessage>();

        NetworkServer.SendToAll(player_movement_msg, _msg);
    }