Exemple #1
0
        public void TransferOwnershipOfGraspables(NVRHandData hand)
        {
            if (hand.HoldButtonDownForModerator && hand.IsInteracting)
            {
                if (hand.CurrentlyInteractingTag == "Graspables")
                {
                    GameObject graspedObj = this.graspables.SingleOrDefault(obj => obj.name == hand.CurrentlyInteractingName);

                    if (graspedObj.name == hand.CurrentlyInteractingName)
                    {
                        graspedObj.GetComponent <Rigidbody>().useGravity  = true;
                        graspedObj.GetComponent <Rigidbody>().isKinematic = false;

                        graspedObj.GetComponentInChildren <PhotonView>().TransferOwnership(PhotonNetwork.LocalPlayer);
                        //PhotonView[] photonViews = graspedObj.GetComponentsInChildren<PhotonView>();
                        //foreach (PhotonView photonView in photonViews)
                        //{
                        //	photonView.TransferOwnership(PhotonNetwork.LocalPlayer);
                        //}

                        this.rpcManager.ForwardObjectGrasp(graspedObj.name);
                    }
                }
            }
        }
        //      [PunRPC]
        //private void ForwardNVRHandDataRPC(
        //          bool holdButtonDown, bool holdButtonUp, bool holdButtonPressed, bool isRight, bool isLeft,
        //          string currentlyInteractingName, string currentlyInteractingTag, bool isInteracting
        //      )
        //{
        //	Debug.LogError("ForwardNVRHandDataRPC");

        //	this.HoldButtonDown           = holdButtonDown;
        //	this.HoldButtonUp             = holdButtonUp;
        //	this.HoldButtonPressed        = holdButtonPressed;
        //	this.IsRight                  = isRight;
        //	this.IsLeft                   = isLeft;
        //	this.CurrentlyInteractingName = currentlyInteractingName;
        //	this.CurrentlyInteractingTag  = currentlyInteractingTag;
        //	this.IsInteracting            = isInteracting;
        //      }



        public void ForwardNVRHandData(NVRHandData handData)
        {
//			this.photonView.RPC("ForwardSubRosGuidanceMessageRPC", RpcTarget.All, guidaneMsg.message, guidaneMsg.display_type, guidaneMsg.source_language, guidaneMsg.target_language);

            this.photonView.RPC("ForwardNVRHandDataRPC", RpcTarget.Others,
                                handData.HoldButtonDown, handData.HoldButtonUp, handData.HoldButtonPressed, handData.IsRight, handData.IsLeft,
                                handData.CurrentlyInteractingName, handData.CurrentlyInteractingTag, handData.IsInteracting
                                );
        }