Exemplo n.º 1
0
    void FixedUpdate()
    {
        if (!PhotonNetwork.connected)
        {
            return;
        }

        NetworkPlayerData data = new NetworkPlayerData(
            new Vector3[] { NVRPlayer.Instance.Head.transform.position, NVRPlayer.Instance.RightHand.transform.position, NVRPlayer.Instance.LeftHand.transform.position },
            new Quaternion[] { NVRPlayer.Instance.Head.transform.rotation, NVRPlayer.Instance.RightHand.transform.rotation, NVRPlayer.Instance.LeftHand.transform.rotation });

        BinaryFormatter formatter = new BinaryFormatter();

        byte[] serializedData = SerializationToolkit.ObjectToByteArray(data);

        photonView.RPC("UpdateNetworkPlayer", PhotonTargets.Others, serializedData, personalID);
    }
    void FixedUpdate()
    {
        if (!PhotonNetwork.inRoom)
        {
            return;
        }

        NetworkPlayerData data = new NetworkPlayerData(
            new Vector3[] { NVRPlayer.Instance.transform.position, NVRPlayer.Instance.Head.transform.localPosition,
                            NVRPlayer.Instance.RightHand.transform.localPosition, NVRPlayer.Instance.LeftHand.transform.localPosition,
                            NVRPlayer.Instance.Torso.transform.localPosition },
            new Quaternion[] { NVRPlayer.Instance.transform.rotation, NVRPlayer.Instance.Head.transform.localRotation,
                               NVRPlayer.Instance.RightHand.transform.localRotation, NVRPlayer.Instance.LeftHand.transform.localRotation,
                               NVRPlayer.Instance.Torso.transform.localRotation });

        byte[] serializedData = SerializationToolkit.ObjectToByteArray(data);

        photonView.RPC("UpdateNetworkPlayer", PhotonTargets.Others, serializedData, playerID);
    }
Exemplo n.º 3
0
    public void callHit(HitInfo info)
    {
        if (localHited || !_active)
        {
            return;
        }

        localHited  = true;
        globalHited = true;
        lastHit     = (LimbType)info.limbHit;
        float multiplier = 1;

        switch (lastHit)
        {
        case LimbType.Head:
            multiplier = 3;
            break;

        case LimbType.Hand:
            multiplier = 1;
            break;

        case LimbType.Torso:
            multiplier = 2;
            break;
        }

        if (lastHit == LimbType.None)
        {
            return;
        }

        photonView.RPC("CalculateScore", PhotonTargets.All, NetworkPlayerManager.Instance.playerID, multiplier);
        photonView.RPC("ReceiveRegisterHit", PhotonTargets.Others, SerializationToolkit.ObjectToByteArray(info));

        if (OnJoustHit != null)
        {
            OnJoustHit.Invoke(info);
        }

        Instantiate(blood, info.hitPoint.Deserialize(), Quaternion.identity);
    }
    public void SendEndInterraction(NVRInteractable item)
    {
        SerializableRigidbody rb = new SerializableRigidbody(item.Rigidbody);

        photonView.RPC("ReceiveEndInteraction", PhotonTargets.Others, SerializationToolkit.ObjectToByteArray(rb), GetObjectID(item));
    }
    public void SendBeginInterraction(NVRInteractable item, NVRHand hand)
    {
        SerializableTransform t = new SerializableTransform(item.transform.position - hand.transform.position, item.transform.rotation);

        photonView.RPC("ReceiveBeginInteraction", PhotonTargets.Others, SerializationToolkit.ObjectToByteArray(t), hand.IsRight, GetObjectID(item), NetworkPlayerManager.Instance.personalID);
    }