コード例 #1
0
        public void RpcGrab(int humanoidId, int objViewID, bool isLeft, bool rangeCheck)
        {
            PhotonView objView = PhotonView.Find(objViewID);
            GameObject obj     = objView.gameObject;

            if (debug <= HumanoidNetworking.Debug.Info)
            {
                PhotonLog("RpcGrab " + obj);
            }

            if (obj == null)
            {
                return;
            }

            HumanoidControl humanoid = HumanoidNetworking.FindRemoteHumanoid(humanoids, humanoidId);

            if (humanoid == null)
            {
                if (debug <= HumanoidNetworking.Debug.Warning)
                {
                    PhotonLogWarning("Could not find humanoid: " + humanoidId);
                }
                return;
            }

            HandTarget handTarget = isLeft ? humanoid.leftHandTarget : humanoid.rightHandTarget;

            if (handTarget != null)
            {
                HandInteraction.LocalGrab(handTarget, obj, rangeCheck);
            }
        }
コード例 #2
0
        [ClientRpc] // @ remote client
        public void RpcClientGrab(int nwId, int humanoidId, GameObject obj, bool leftHanded, bool rangeCheck)
        {
            if (debug <= HumanoidNetworking.Debug.Info)
            {
                Debug.Log(nwId + ": RpcGrab " + obj);
            }

            HumanoidControl humanoid = HumanoidNetworking.FindRemoteHumanoid(humanoids, humanoidId);

            if (humanoid == null)
            {
                if (debug <= HumanoidNetworking.Debug.Warning)
                {
                    Debug.LogWarning(netId.Value + ": Could not find humanoid: " + humanoidId);
                }
                return;
            }

            HandTarget handTarget = leftHanded ? humanoid.leftHandTarget : humanoid.rightHandTarget;

            HandInteraction.LocalGrab(handTarget, obj, rangeCheck);
        }