コード例 #1
0
    // Update is called once per frame
    void Update()
    {
        if (!isServer)        //client
        {
            if (hasAuthority) //we should now be able to move the object
            {
                pendingAccess = false;

                print("we have authority");
                if (grabbedByPlayer)
                {
                    // print(name + " id: " + netId);
                    if (localActor.lastCollider != null) //both hands are touching the same object
                    {
                        //print("both collider set");

                        onb.setColor(Color.red);
                        onb.vive = localActor.viveStatus;
                        onb.leap = localActor.leapStatus;
                        onb.setActor(localActor);
                        onb.OnGrabbed();
                    }
                }
                else
                {
                    if (!pendingRelease)
                    {
                        onb.OnReleased();
                        onb.setColor(Color.green);
                        print("we return auhtority: ");

                        /*if(localActor!=null)
                         *  localActor.ReturnObjectAuthority(netID);*/
                        pendingRelease = true;
                    }
                }
            }
            else if (pendingRelease)
            {
                pendingRelease = false;
            }
            else if (grabbedByPlayer && !pendingAccess)
            {
                print("we want control");
                localActor.RequestObjectAuthority(netID);
                pendingAccess = true;
            }
        }
    }
コード例 #2
0
 public void TargetAuthorityRemoved(NetworkConnection connection)
 {
     Debug.Log("From Host: Authority Removed.");
     requestProcessed = true;
     onb.OnReleased();
 }
コード例 #3
0
 void RpcLostAuthority()
 {
     Debug.Log("AuthorityManager: calling onb.OnReleased");
     onb.OnReleased();
 }