public void TargetAuthorityAssigned(NetworkConnection connection) { Debug.Log("From Host: Get authority."); requestProcessed = true; waitForAuthority = false; onb.OnGrabbed(localActor); }
void RpcGotAuthority() { if (playerGrabs) { Debug.Log("AuthorityManager: calling onb.OnGrabbed"); onb.OnGrabbed(); } }
// 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; } } }