/// <summary> /// /// </summary> void Start() { if (PhotonNetwork.isMasterClient && view.owner == null) { view.RequestOwnership(); } }
void UpdateOwner() { if (!pv.isMine) { int whose = pv.ownerId; if (whose == 2 && CanServerControl) { pv.RequestOwnership(); } else if (whose == 1 && CanServerControl) { return; } else if (whose == 2 && CanClientControl) { return; } else if (whose == 1 && CanClientControl) { pv.RequestOwnership(); } } else { } }
/// <summary> /// /// </summary> private void Start() { m_Animator = GetComponent <Animator>(); if (PhotonNetwork.isMasterClient && view.owner == null) { view.RequestOwnership(); Debug.Log("Assign Master as owner"); } }
private void OnTriggerEnter(Collider other) { if (other.gameObject.name == "Gem(Clone)") { if (!gem || gem != other.gameObject) { if (!view.IsMine) { view.RequestOwnership(); Invoke("setanim", 0.5f); gem = other.gameObject; other.gameObject.GetComponent <SmallGem>().DestroyGem(); } else { if (anim.GetBool("b1") && anim.GetBool("b2")) { anim.SetBool("b3", true); gem = other.gameObject; other.gameObject.GetComponent <SmallGem>().DestroyGem(); } else if (anim.GetBool("b1") && !anim.GetBool("b2")) { anim.SetBool("b2", true); gem = other.gameObject; other.gameObject.GetComponent <SmallGem>().DestroyGem(); } else { anim.SetBool("b1", true); gem = other.gameObject; other.gameObject.GetComponent <SmallGem>().DestroyGem(); } } } } if (active) { if (other.gameObject.name == "Player2(Clone)") { if (other.gameObject.GetComponent <PhotonView>().IsMine) { other.transform.parent = transform; view.RPC("Parenting_RPC", RpcTarget.Others, other.gameObject.GetPhotonView().ViewID); return; } Debug.Log("MovePlatform was parenting"); } } }
void NewRound() { if (PhotonNetwork.isMasterClient) { round = round + 1; roomProp ["Round"] = round; room.SetCustomProperties(roomProp); PhotonView flag = GameObject.FindGameObjectWithTag("Flag").GetComponent <PhotonView> (); PhotonView fort = GameObject.FindGameObjectWithTag("Fort").GetComponent <PhotonView> (); if (!fort.isMine) { fort.RequestOwnership(); } if (!flag.isMine) { flag.RequestOwnership(); } PhotonNetwork.Destroy(flag); PhotonNetwork.Destroy(fort); Invoke("SpawnFlag", 0.5f); } updateHudInfo(); complete = false; scoreAdded = false; }
public void TakeOwnershipOfView() { if (!photonView.IsMine) { photonView.RequestOwnership(); } }
public void IsInteractedOn() { if (photonView != null) { photonView.RequestOwnership(); } }
IEnumerator NewRound() { yield return(new WaitForSeconds(2.5f)); if (PhotonNetwork.isMasterClient) { round = round + 1; roomProp ["Round"] = round; room.SetCustomProperties(roomProp); photonView.RPC("DestroyFort", PhotonTargets.All); PhotonView flag = GameObject.FindGameObjectWithTag("Flag").GetComponent <PhotonView> (); if (!flag.isMine) { flag.RequestOwnership(); } PhotonNetwork.Destroy(flag); } yield return(new WaitForSeconds(0.5f)); if (PhotonNetwork.isMasterClient) { PhotonView fort = GameObject.FindGameObjectWithTag("Fort").GetComponent <PhotonView> (); if (!fort.isMine) { fort.RequestOwnership(); } PhotonNetwork.Destroy(fort); Invoke("SpawnFlag", 0.5f); } updateHudInfo(); complete = false; scoreAdded = false; }
public bool Take() { PhotonView pv = gameObject.GetPhotonView(); if (gameObject.GetPhotonView() != null) { bool owned = HasOwnership(PhotonNetwork.player); if (StoredInScene) { pv.RequestOwnership(); pv.ownerId = PhotonNetwork.player.ID; } else if (CanTake() && !owned) { pv.RPC("Grab", PhotonTargets.Others); } if (HasOwnership(PhotonNetwork.player)) { return(true); } else { return(false); } } else { return(true); } }
public void RequestOwnerChange() { if (!PV.IsMine) { PV.RequestOwnership(); } }
private void OnCollisionEnter(Collision collision) { if (collision.transform.root.gameObject == MultiplayerPlayer.LocalPlayer && !pView.AmOwner) { pView.RequestOwnership(); } }
private void Update() { if (PhotonScriptor.ConnectingScript.informConnected() == true) { if (addcallBacks == false) { addcallBacks = true; Debug.Log("add call back"); PhotonNetwork.AddCallbackTarget(this); } } if (_photonView.IsMine == true) { return; } if (TimeManager.BluePrint.BruePrintPhaze.InformBluePrintState() == true) { if (PN == ConnectingScript.informPlayerID()) { if (TakeOverOwnership == false) { Debug.Log("owmership requested"); _photonView.RequestOwnership(); TakeOverOwnership = true; } } } }
private void OnTriggerEnter(Collider other) { if (other.GetComponent <Rigidbody>()) { ball = other.GetComponent <Rigidbody>(); pball = other.GetComponent <PhotonView>(); pball.RequestOwnership(); } }
/// <summary> /// After call PhotonView.RequestOwnership, wait until take ownership. /// </summary> public static async UniTask RequestOwnershipAsync(this PhotonView view, CancellationToken token = default) { if (view.IsMine) { return; } view.RequestOwnership(); await view.IsMineAsyncEnumerable().FirstOrDefaultAsync(x => x, token); }
public void UsePost(GameObject player) { if (!postPlayer) { postPlayer = player; audioData.PlayOneShot(enter, 1); PV.RPC("OccupyPost", RpcTarget.Others); PhotonView playerPV = postPlayer.GetComponentInChildren <PhotonView> (); PhotonView postPV = post.GetComponent <PhotonView> (); // PhotonView[] photonViews = post.GetComponents<PhotonView>(); // foreach (PhotonView view in photonViews) // { // print(view.ViewID); // } if (postPV) { postPV.RequestOwnership(); } switch (type) { case postType.Canon: Canon tmpCanon = post.GetComponent <Canon> (); tmpCanon.enabled = true; break; case postType.Thruster: ThrusterControls tmp = post.GetComponent <ThrusterControls> (); tmp.enabled = true; break; case postType.Turret: Turret turret = post.GetComponent <Turret> (); turret.enabled = true; break; case postType.Rotate: RotateShip rotate = post.GetComponent <RotateShip> (); rotate.enabled = true; break; case postType.Shield: Shield shield = post.GetComponent <Shield> (); shield.enabled = true; break; case postType.MiniShip: postPlayer.transform.GetChild(1).gameObject.SetActive(false); MiniShip ship = post.GetComponent <MiniShip> (); ship.enabled = true; ship.ActivateShip(); break; default: break; } } }
public void OnBeginDrag(PointerEventData eventData) { var pos = Input.mousePosition; mouseDiff = transform.position - Camera.main.ScreenToWorldPoint(pos); transform.SetAsLastSibling(); photonView.RequestOwnership(); myGroup.blocksRaycasts = false; isDraging = true; }
private void OnTriggerEnter(Collider other) { if (other.CompareTag("weapon")) { if (!pv.IsMine) { pv.RequestOwnership(); } } }
private void Start() { Debug.Log($"GunnerRole Start() Is {(photonView.IsMine ? "": "NOT ")} mine. I am {Launcher.role}."); if (!photonView.IsMine && Launcher.role == Roles.Gunner) { //shipPhotonView.RequestOwnership(); photonView.RequestOwnership(); thisPhotonView.RequestOwnership(); } }
private void OnTriggerEnter(Collider other) { if (other.gameObject.tag == "Obstacle") { PhotonView view = other.gameObject.GetPhotonView(); if (!view.IsMine) { view.RequestOwnership(); } } }
private void OnTriggerEnter(Collider other) { if (other.CompareTag("enemy")) { enemy = other.gameObject.GetComponent <Enemy>(); pv = other.gameObject.GetComponent <PhotonView>(); if (!pv.IsMine) { pv.RequestOwnership(); } } }
public override void GrabBegin(OVRGrabber hand, Collider grabPoint) { base.GrabBegin(hand, grabPoint); _ooi.IsBeingManipulated = true; if (_view) { if (!_view.IsMine) { _view.RequestOwnership(); } } }
private void OnMouseDown() { Cursor.visible = false; isFollowingParnt = true; _isMouseOn = true; _followPos = transform.position; _mousePos = Input.mousePosition; _rb.freezeRotation = true; _pv.RequestOwnership(); _isfollowingPos = true; _pv.RPC("ConstrainRotation", RpcTarget.AllBuffered); _pv.RPC("UpdateIsFolloingPos", RpcTarget.AllBuffered, _isfollowingPos); }
protected override void OnSelectEnter(XRBaseInteractor interactor) { base.OnSelectEnter(interactor); canSelect = true; isSelectExit = false; selectRecognitionTimeVal = 0f; if (pv) { pv.RequestOwnership(); } }
public void AttemptInteraction() { Debug.Log("isHeld = " + isHeld); if (photonView == null) { return; } if (isHeld == true) { return; } photonView.RequestOwnership(); }
public void SetIsActive() { isActive = true; if (!view.IsMine) { view.RequestOwnership(); Invoke("setanim", 0.5f); } else { anim.SetBool("On", isActive); } }
public void Take(GameObject taker) { this.name = originalName + " [" + taker.name + "]"; if (!taker.GetComponent <PhotonView>().IsMine) { return; } PhotonView pv = this.GetComponent <PhotonView>(); pv.RequestOwnership(); }
public void TransferOwnership() { if (PhotonView.Owner.IsLocal == false) { Debug.Log("Requesting Ownership"); PhotonView.RequestOwnership(); PhotonNetwork.Destroy(drink); } else { PhotonNetwork.Destroy(drink); } }
public override void OnJoinedRoom() { PhotonView[] PVs = localAvatar.GetPhotonViewsInChildren(); for (int i = 0; i < PVs.Length; i++) { PVs[i].RequestOwnership(); } PhotonView LYPV = localYoke.GetPhotonView(); LYPV.RequestOwnership(); }
void OnGameBegin() { Vector3 position = playerPrefab.transform.position; position.z = zPositionPlayer1; GameObject ball = PhotonNetwork.Instantiate(playerPrefab.name, position, transform.rotation, 0); PhotonView view = ball.GetComponent <PhotonView>(); view.RequestOwnership(); Debug.Assert(view.isMine); onGameBegin?.Invoke(); }
public void gainFlag() { flag = GameObject.FindGameObjectWithTag("Flag"); flag.GetComponent <Animator> ().SetBool("Wavin", true); Collider2D[] cols = flag.GetComponents <Collider2D> (); //deactivate rigidbody component Rigidbody2D rb = flag.GetComponent <Rigidbody2D> (); rb.gravityScale = 0; rb.freezeRotation = false; rb.isKinematic = true; flag.transform.parent = flagPos.transform; foreach (Collider2D coll in cols) { coll.enabled = false; } PhotonView flagPhotonView = flag.GetComponent <PhotonView> (); if (gameObject.GetPhotonView().isMine) { flagPhotonView.RequestOwnership(); } flag.transform.localPosition = Vector3.zero; flag.transform.localRotation = Quaternion.Euler(Vector3.zero); if (PhotonNetwork.offlineMode) { GameObject[] players = GameObject.FindGameObjectsWithTag("Player"); foreach (GameObject ply in players) { AILogic ailog = ply.GetComponent <AILogic> (); if (ailog) { if (ply == this.gameObject) { ailog.StateChange(3); } else { ailog.StateChange(2); } } } } isHandlingFlag = true; arrow.GetComponent <FixedRotation> ().isHandling = true; }