void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) { if (stream.isWriting) { //We own this player: send the others our data stream.SendNext((int)controllerScript._characterState); stream.SendNext(transform.position); stream.SendNext(transform.rotation); } else { //Network player, receive data controllerScript._characterState = (CharacterState)(int)stream.ReceiveNext(); correctPlayerPos = (Vector3)stream.ReceiveNext(); correctPlayerRot = (Quaternion)stream.ReceiveNext(); // avoids lerping the character from "center" to the "current" position when this client joins if (firstTake) { firstTake = false; this.transform.position = correctPlayerPos; transform.rotation = correctPlayerRot; } } }
void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) { if (stream.isWriting) { //This is executed on the owner of the PhotonView //The owner sends it's position over the network stream.SendNext(transform.position);//"Encode" it, and send it } else { //Executed on all non-owners //receive a position and set the object to it Vector3 lastReceivedPosition = (Vector3)stream.ReceiveNext(); //We've just recieved the current servers position of this object in 'posReceive'. transform.position = lastReceivedPosition; //To reduce laggy movement a bit you could comment the line above and use position lerping below instead: //It would be even better to save the last received server position and lerp to it in Update because it is executed more often than OnPhotonSerializeView } }
// void Update() { // if (!photonView.isMine) { // transform.position = Vector3.Lerp(transform.position, correctPlayerPosition, 0.1f); // transform.rotation = Quaternion.Lerp (transform.rotation, correctPlayerRotation, 0.1f); // } // } void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) { Animator anim = transform.GetComponentInChildren<Animator> (); if (stream.isWriting) { stream.SendNext(transform.position); stream.SendNext(transform.rotation); stream.SendNext(anim.GetFloat("Forward")); stream.SendNext(anim.GetFloat("Turn")); stream.SendNext(anim.GetBool("OnGround")); stream.SendNext(anim.GetFloat("Jump")); stream.SendNext(anim.GetFloat("JumpLeg")); stream.SendNext(anim.GetBool("Guard")); stream.SendNext(anim.GetFloat("Block")); } else { this.correctPlayerPosition = (Vector3) stream.ReceiveNext(); this.correctPlayerRotation = (Quaternion) stream.ReceiveNext(); this.anim.SetFloat("Forward", (float) stream.ReceiveNext()); this.anim.SetFloat("Turn", (float) stream.ReceiveNext()); this.anim.SetBool("OnGround", (bool) stream.ReceiveNext()); this.anim.SetFloat("Jump", (float) stream.ReceiveNext()); this.anim.SetFloat("JumpLeg", (float) stream.ReceiveNext()); this.anim.SetBool("Guard", (bool) stream.ReceiveNext()); this.anim.SetFloat("Block", (float) stream.ReceiveNext()); } }
void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) { if(stream.isWriting) { stream.SendNext(transform.position); stream.SendNext(transform.rotation); if(anim.IsPlaying("Run")) { stream.SendNext(useThisMove = 1); } if(anim.IsPlaying ("Idle")) { stream.SendNext (useThisMove = -1); } if(anim.IsPlaying ("AutoAttack")) { stream.SendNext(useThisMove = -2); } } else { realPosition = (Vector3)stream.ReceiveNext(); realRotation = (Quaternion)stream.ReceiveNext(); useThisMove = (int)stream.ReceiveNext(); } }
public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) { if (stream.isWriting == true) { if (this.m_SynchronizeVelocity == true) { stream.SendNext(this.m_Body.velocity); } if (this.m_SynchronizeAngularVelocity == true) { stream.SendNext(this.m_Body.angularVelocity); } } else { if (this.m_SynchronizeVelocity == true) { this.m_Body.velocity = (Vector3)stream.ReceiveNext(); } if (this.m_SynchronizeAngularVelocity == true) { this.m_Body.angularVelocity = (Vector3)stream.ReceiveNext(); } } }
public void SendOK(int id, int pNum, int chNum, int tNum, int cNum, bool un, PhotonMessageInfo info) { print ("id:" + id.ToString () + "pNum:" + pNum.ToString () + "cNum:" + cNum.ToString () + "tNum:" + tNum); if (un) gameInfo.SetInfo (id, pNum, chNum, tNum, cNum); setOK [id] = un ? true : false; }
public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) { if(stream.isWriting) { // This is our player. We need to send our actual position to the network. stream.SendNext(transform.position); stream.SendNext(transform.rotation); stream.SendNext(anim.GetFloat("Speed")); stream.SendNext(anim.GetBool("Jumping")); } else { // This is someone else's player. We need to reciece their position. // Right now, "realPosition" holds the other person's position at the LAST frame. // Instead of simply updating "realPosition" and continuing to lerp, //we MAY want to set our transform.position to immediately to this old "realPosition" //and then update realPosition realPosition = (Vector3)stream.ReceiveNext (); realRotation = (Quaternion)stream.ReceiveNext (); anim.SetFloat ("Speed", (float)stream.ReceiveNext() ); anim.SetBool ("Jumping", (bool)stream.ReceiveNext() ); if(gotFirstUpdate == false) { transform.position = realPosition; transform.rotation = realRotation; gotFirstUpdate = true; } } }
private void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) { //Debug.Log("============>"); if (stream.isWriting) { stream.SendNext(transform.position); PlayerController player = GetComponent<PlayerController>(); string blockName = player.currentBlock == null ? "" : player.currentBlock.name; stream.SendNext(blockName); } else { PlayerController player = GetComponent<PlayerController>(); this.playerPos = (Vector3)stream.ReceiveNext(); string currentBlock = (string)stream.ReceiveNext(); if (currentBlock != "") { player.transform.parent = null; } else { Node block = GameBoard.FindBlockByName(currentBlock); Debug.Log("===>"+block.name); player.transform.parent = block.transform; } transform.localPosition = this.playerPos; } }
void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) { if (stream.isWriting) { //We own this player: send the others our data // stream.SendNext((int)controllerScript._characterState); stream.SendNext(transform.position); stream.SendNext(transform.rotation); //stream.SendNext(GetComponent<Rigidbody>().velocity); } else { //Network player, receive data //controllerScript._characterState = (CharacterState)(int)stream.ReceiveNext(); correctPlayerPos = (Vector3)stream.ReceiveNext(); correctPlayerRot = (Quaternion)stream.ReceiveNext(); //GetComponent<Rigidbody>().velocity = (Vector3)stream.ReceiveNext(); if (!appliedInitialUpdate) { appliedInitialUpdate = true; transform.position = correctPlayerPos; transform.rotation = correctPlayerRot; //GetComponent<Rigidbody>().velocity = Vector3.zero; } } }
void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) { if (stream.isWriting) { //We own this player: send the others our data ControllerPlayer controllerScript = GetComponent<ControllerPlayer>(); stream.SendNext((int)controllerScript._characterState); stream.SendNext(transform.position); stream.SendNext(transform.rotation); Stats statsScript = GetComponent<Stats>(); stream.SendNext(statsScript.Health); stream.SendNext(statsScript.Lives); } else { //Network player, receive data this.correctPlayerPos = (Vector3)stream.ReceiveNext(); this.correctPlayerRot = (Quaternion)stream.ReceiveNext(); ControllerPlayer controllerScript = GetComponent<ControllerPlayer>(); Stats statsScript = GetComponent<Stats>(); controllerScript._characterState = (CharacterState)(int)stream.ReceiveNext(); statsScript.Health = (int)stream.ReceiveNext(); statsScript.Lives = (int)stream.ReceiveNext(); } }
// this method is called by PUN when this script is being "observed" by a PhotonView (setup in inspector) public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) { // Always send transform (depending on reliability of the network view) if (stream.isWriting) { Vector3 pos = transform.localPosition; Quaternion rot = transform.localRotation; stream.Serialize(ref pos); stream.Serialize(ref rot); } // When receiving, buffer the information else { // Receive latest state information Vector3 pos = Vector3.zero; Quaternion rot = Quaternion.identity; stream.Serialize(ref pos); stream.Serialize(ref rot); lastMovement = (pos - latestCorrectPos) / (Time.time - lastTime); lastTime = Time.time; latestCorrectPos = pos; transform.position = latestCorrectPos; } }
void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) { if (stream.isWriting) { //We own this player: send the others our data //stream.SendNext((int)controllerScript._characterState); //stream bool for grounded, float for running if (!cam.GetComponent<RTSCamera>()) { stream.SendNext(controllerScript.forwardInput); stream.SendNext(controllerScript.grounded); stream.SendNext(transform.position); stream.SendNext(transform.rotation); stream.SendNext(controllerScript.velocity); } } else { //Network player, receive data //controllerScript._characterState = (CharacterState)(int)stream.ReceiveNext(); //stream bool for grounded, float for running forwardInput = (float)stream.ReceiveNext(); grounded = (bool)stream.ReceiveNext(); correctPlayerPos = (Vector3)stream.ReceiveNext(); correctPlayerRot = (Quaternion)stream.ReceiveNext(); correctPlayerVelocity = (Vector3)stream.ReceiveNext(); } }
/// <summary> /// Serializing the photon views /// </summary> /// <param name="stream"> the stream of information </param> /// <param name="info"> information about the messages </param> public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) { // if it's us tell them where we are, else it's everyone else telling use where they are if (stream.isWriting) { // send pos stuff stream.SendNext(transform.position); stream.SendNext(transform.rotation); // send animation stuff stream.SendNext(Mathf.Abs(motor.movement.velocity.x)); stream.SendNext(motor.grounded); // Input info stream.SendNext(Input.GetButton("Jump")); stream.SendNext(Input.GetButtonUp("Fire1")); } else { // recieve pos realPos = (Vector3)stream.ReceiveNext(); realRot = (Quaternion)stream.ReceiveNext(); // receive anim info velocity = (float)stream.ReceiveNext(); onGround = (bool)stream.ReceiveNext(); // Input info jumping = (bool)stream.ReceiveNext(); shoot = (bool)stream.ReceiveNext(); } }
public void SerializeState( PhotonStream stream, PhotonMessageInfo info ) { // Debug.Log ("Serialized State"); //We only need to synchronize a couple of variables to be able to recreate a good //approximation of the ships position on each client //There is a lot of smoke and mirrors happening here //Check out Part 1 Lesson 2 http://youtu.be/7hWuxxm6wsA for more detailed explanations if( stream.isWriting == true ) { Vector3 pos = transform.position; Quaternion rot = transform.rotation; stream.SendNext( pos ); stream.SendNext( rot ); } else { t=0; // achterlopende position naar nieuwe binnenkomende position lerpen startPosition = transform.position; m_NetworkPosition = (Vector3)stream.ReceiveNext(); m_NetworkRotation = (Quaternion)stream.ReceiveNext(); distance = Vector3.Distance(startPosition,m_NetworkPosition); time = distance/speed; m_LastNetworkDataReceivedTime = info.timestamp; } }
public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) { if (stream.isWriting) { Vector3 pos = transform.localPosition; Quaternion rot = transform.localRotation; stream.Serialize(ref pos); stream.Serialize(ref rot); } else { // Receive latest state information Vector3 pos = Vector3.zero; Quaternion rot = Quaternion.identity; stream.Serialize(ref pos); stream.Serialize(ref rot); this.latestCorrectPos = pos; // save this to move towards it in FixedUpdate() this.onUpdatePos = transform.localPosition; // we interpolate from here to latestCorrectPos this.fraction = 0; // reset the fraction we alreay moved. see Update() transform.localRotation = rot; // this sample doesn't smooth rotation } }
private void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) { if (stream.isWriting) { //We own this player: send the others our data stream.SendNext(transform.position); stream.SendNext(transform.rotation); // animation data int[] animStates = _playerAnim.GetAnimationBooleans(); stream.SendNext(animStates[0]); stream.SendNext(animStates[1]); stream.SendNext(animStates[2]); } else { //Network player, receive data _correctPlayerPos = (Vector3)stream.ReceiveNext(); _correctPlayerRot = (Quaternion)stream.ReceiveNext(); // animation data _playerAnim.ApplyNetworkAnimations((int)stream.ReceiveNext(), (int)stream.ReceiveNext(), (int)stream.ReceiveNext()); syncTime = 0f; syncDelay = Time.time - lastSynchronizationTime; lastSynchronizationTime = Time.time; } }
public void OnPhotonSerializeView(PhotonStream aStream, PhotonMessageInfo aInfo) { if (aStream.isWriting) { aStream.SendNext(transform.position); aStream.SendNext(transform.rotation.eulerAngles.z); aStream.SendNext(m_health); } else { m_photonPosition = (Vector3)aStream.ReceiveNext(); m_photonRotation = (float)aStream.ReceiveNext(); m_health = (int)aStream.ReceiveNext(); stopWatch.Stop(); if (stopWatch.ElapsedMilliseconds > (1000 / PhotonNetwork.sendRate)) { m_photonReleasedPositions.Add(new TimePosition(m_photonPosition, (float)stopWatch.ElapsedMilliseconds, m_photonRotation)); if (m_once && m_photonReleasedPositions.Count >= 4) { m_once = false; StartCoroutine("ReleasePositions"); } stopWatch.Reset(); } stopWatch.Start(); } }
void HandleReceivingNetworkData(PhotonStream stream, PhotonMessageInfo info) { // Set initial positions instantly. if (!hasInitialUpdate) { isPlayerActive = true; transform.position = realPosition; transform.rotation = realRotation; animator = GetComponent<Animator> (); animator.SetFloat("Speed", 0); animator.SetBool("IsJumping", false); shield = GetComponent<Shield> (); shield.isActive = false; hasInitialUpdate = true; } // Receive updates from other players. gameObject.SetActive((bool)stream.ReceiveNext()); realPosition = (Vector3)stream.ReceiveNext(); realRotation = (Quaternion)stream.ReceiveNext(); animator.SetFloat("Speed", (float)stream.ReceiveNext()); animator.SetBool("IsJumping", (bool)stream.ReceiveNext()); shield.isActive = (bool)stream.ReceiveNext(); }
void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) { if (stream.isWriting) { //データの送信 stream.SendNext(transform.position); stream.SendNext(transform.rotation); stream.SendNext(this.GetComponent<Renderer>().material.color.r); stream.SendNext(this.GetComponent<Renderer>().material.color.g); stream.SendNext(this.GetComponent<Renderer>().material.color.b); stream.SendNext(this.GetComponent<Renderer>().material.color.a); ti = Time.timeSinceLevelLoad; Debug.LogWarning("r = " + this.GetComponent<Renderer>().material.color.r + " g = " + this.GetComponent<Renderer>().material.color.g + " b = " + this.GetComponent<Renderer>().material.color.b + " a = " + this.GetComponent<Renderer>().material.color.a); } else { //データの受信 transform.position = (Vector3)stream.ReceiveNext(); transform.rotation = (Quaternion)stream.ReceiveNext(); float r = (float)stream.ReceiveNext(); float g = (float)stream.ReceiveNext(); float b = (float)stream.ReceiveNext(); float a = (float)stream.ReceiveNext(); ti = Time.timeSinceLevelLoad - ti; Debug.Log("r = " + r + " g = " + g + " b = " + b + " a = " + a); this.GetComponent<Renderer>().material.color = new Vector4(r, g, b, a); } }
void InventoryPlayerPickedUpItem(int ufpsItemID, int ufpsPlayerID, Vector3 itemPosition, Quaternion itemRotation, PhotonMessageInfo info) { List<vp_ItemPickup> pickups; if (!vp_MPPickupManager.Instance.Pickups.TryGetValue(ufpsItemID, out pickups)) return; if (pickups[0].gameObject != null) vp_Utility.Activate(pickups[0].gameObject, false); Debug.Log("Client looted item with UFPS ID: " + ufpsItemID); vp_MPNetworkPlayer player; if (!vp_MPNetworkPlayer.PlayersByID.TryGetValue(ufpsPlayerID, out player)) return; if (player == null) return; if (player.Collider == null) return; foreach (vp_ItemPickup p in pickups) { var a = p as ObjectTriggererItemUFPS; a.TryGiveToPlayer(player.Collider, p.Amount, false); Debug.Log("Giving UFPS item to player - ItemID: " + a.ID); } }
void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) { UnityEngine.Debug.Log("point"); if (stream.isWriting) { var pointText = GameObject.Find("Point").GetComponent<Text>(); string point = pointText.text; // We own this player: send the others our data stream.SendNext(transform.position); stream.SendNext(transform.rotation); UnityEngine.Debug.Log(pointText.text); stream.SendNext(pointText.text); UnityEngine.Debug.Log("point2"); } else { // Network player, receive data this.correctPlayerPos = (Vector3)stream.ReceiveNext(); this.correctPlayerRot = (Quaternion)stream.ReceiveNext(); UnityEngine.Debug.Log((Vector3)stream.ReceiveNext()); var pointText = GameObject.Find("EnemyPoint").GetComponent<Text>(); UnityEngine.Debug.Log("point3"); pointText.text = (string)stream.ReceiveNext(); } }
public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) { if (PhotonNetwork.isMasterClient) { if (stream.isWriting) { // We own this player: send the others our data stream.SendNext (transform.position); stream.SendNext (transform.rotation); //stream.SendNext (this.GetComponent<DumbStates> ().signalLeft); //stream.SendNext (this.GetComponent<DumbStates> ().signalRight); } } else { // Network player, receive data CorrectPos = (Vector3)stream.ReceiveNext (); CorrectRot = (Quaternion)stream.ReceiveNext (); //signalLeft = (bool)stream.ReceiveNext (); //signalRight = (bool)stream.ReceiveNext (); if (!SignalON && (signalLeft || signalRight)) { if (signalLeft) { //this.GetComponent<DumbStates> ().onLTS (); } if (signalRight) { //this.GetComponent<DumbStates> ().onRTS (); } SignalON = true; } if (SignalON && !(signalLeft || signalRight)) { //this.GetComponent<DumbStates> ().offTurnSignals(); SignalON=false; } } }
//Serilize Data Across the network, we want everyone to know where they are void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) { //Send to everyone else a local players variables to be synced and recieved by all other players on network if (stream.isWriting) { //send to clients where we are stream.SendNext(transform.position); stream.SendNext(transform.rotation); stream.SendNext(health); //Sync Animation States } else { //Get from clients where they are //Write in the same order we read, if not writing we are reading. realPosition = (Vector3)stream.ReceiveNext(); realRotation = (Quaternion)stream.ReceiveNext(); health = (float)stream.ReceiveNext(); //Sync Animation States } }
void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) { if(stream.isWriting) { stream.SendNext(transform.position); } else { position = (Vector3)stream.ReceiveNext(); } }
void OnPhotonInstantiate(PhotonMessageInfo msg) { // This is our own player if (photonView.isMine) { //camera.main.enabled=false; localPlayer = true; Destroy(GameObject.Find("LevelCamera")); Machinegun gun = transform.GetComponentInChildren < Machinegun>(); gun.localPlayer = true; } // This is just some remote controlled player, don't execute direct // user input on this. DO enable multiplayer controll else { name += msg.sender.name; transform.Find("CrateCamera").gameObject.active = false; FPSWalker4 tmp2 = GetComponent<FPSWalker4>() as FPSWalker4; tmp2.enabled = false; MouseLook tmp5 = GetComponent<MouseLook>() as MouseLook; tmp5.enabled = false; } }
// this method is called by PUN when this script is being "observed" by a PhotonView (setup in inspector) public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) { if (stream.isWriting) { // the controlling player of a cube sends only the position Vector3 pos = transform.localPosition; stream.Serialize(ref pos); } else { // other players (not controlling this cube) will read the position and timing and calculate everything else based on this Vector3 updatedLocalPos = Vector3.zero; stream.Serialize(ref updatedLocalPos); double timeDiffOfUpdates = info.timestamp - this.lastTime; // the time that passed after the sender sent it's previous update this.lastTime = info.timestamp; // the movementVector calculates how far the "original" cube moved since it sent the last update. // we calculate this based on the sender's timing, so we exclude network lag. that makes our movement smoother. this.movementVector = (updatedLocalPos - this.latestCorrectPos) / (float)timeDiffOfUpdates; // the errorVector is how far our cube is away from the incoming position update. using this corrects errors somewhat, until the next update arrives. // with this, we don't have to correct our cube's position with a new update (which introduces visible, hard stuttering). this.errorVector = (updatedLocalPos - transform.localPosition) / (float)timeDiffOfUpdates; // next time we get an update, we need this update's position: this.latestCorrectPos = updatedLocalPos; } }
public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) { if (stream.isWriting) { Vector3 pos = transform.localPosition; Quaternion rot = transform.localRotation; stream.Serialize(ref pos); stream.Serialize(ref rot); } else { Vector3 pos = Vector3.zero; Quaternion rot = Quaternion.identity; stream.Serialize(ref pos); stream.Serialize(ref rot); latestCorrectPos = pos; onUpdatePos = transform.localPosition; fraction = 0; transform.localRotation = rot; } }
void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) { if (stream.isWriting) { // write time & position to stream stream.SendNext(PhotonNetwork.time); // send orientation stream.SendNext((double)transform.rotation.eulerAngles.y); // get Y-rotation } else { // receive keyframe double time = (double)stream.ReceiveNext(); double orientation = (double)stream.ReceiveNext(); if (m_OrientationKeyframesList == null) m_OrientationKeyframesList = new KeyframeList<double>(); m_OrientationKeyframesList.Add(time, orientation); if (m_OrientationKeyframesList.Count > 2) { //Debug.Log("removing old keyframes"); // remove old keyframes ( let's say 5 seconds old? ) m_OrientationKeyframesList.RemoveAllBefore(time - 5); } } }
public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) { if(stream.isWriting) { // this is my player. need to send my actual position to the network stream.SendNext(transform.position); stream.SendNext(_charController.velocity); stream.SendNext(transform.rotation); } else { //this is another player. need to get his position data. then update my version of this player Vector3 syncPosition = (Vector3)stream.ReceiveNext(); Vector3 syncVelocity = (Vector3)stream.ReceiveNext(); syncEndRotation = (Quaternion)stream.ReceiveNext(); syncStartRotation = transform.rotation; syncTime = 0f; syncDelay = Time.time - lastSynchronizationTime; lastSynchronizationTime = Time.time; syncEndPosition = syncPosition + syncVelocity * syncDelay; syncStartPosition = transform.position; } }
/// <summary> /// serialization method of photon /// </summary> /// <param name="stream"></param> /// <param name="info"></param> public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) { m_PositionControl.OnPhotonSerializeView(transform.position, stream, info); m_RotationControl.OnPhotonSerializeView(transform.rotation, stream, info); m_ScaleControl.OnPhotonSerializeView(transform.localScale, stream, info); if (isMine == false && m_PositionModel.DrawErrorGizmo == true) { DoDrawEstimatedPositionError(); } if (stream.isWriting) { //We own this player: send the others our data stream.SendNext(gameObject.name); stream.SendNext(HeatTarget.position); stream.SendNext(HeatTarget.rotation); stream.SendNext(Controller.m_PlayerState); stream.SendNext(Controller.grounded); } else { //Network player, receive data RemotePlayerName = (string)stream.ReceiveNext(); HeadPos = (Vector3)stream.ReceiveNext(); HeadRot = (Quaternion)stream.ReceiveNext(); m_state = (PlayerState)stream.ReceiveNext(); m_grounded = (bool)stream.ReceiveNext(); // m_ReceivedNetworkUpdate = true; } }
void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) { //Esta funcion solo es por un fallo que da en el juego Debug.Log("[NetworkManager][OnPhotonSerializeView]" + info.ToString()); }
public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) { // Method not really needed, but needs to be overridden due to IPunObservable }
public override void OnPhotonInstantiate(PhotonMessageInfo info) { base.OnPhotonInstantiate(info); wasSpawned = true; }
public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) { // This stream is sending and receiving data to a PhotonView observable if (stream.IsWriting) { // If true, this means the photon view is running on my device and I'm the one to who // Controls this player. We should send our position & rotation data to the the "REMOTE ME" // Which is the version of my player on other peoples devices // NOTE - We extract our own battle arena position so that users can apply theirs. stream.SendNext(rb.position - battleArenaGameObject.transform.position); stream.SendNext(rb.rotation); if (synchronizeVelocity) { stream.SendNext(rb.velocity); } if (synchronizeAngularVelocity) { stream.SendNext(rb.angularVelocity); } } else { // If false, it means the stream is reading. Meaning we're listening to other players. // NOTE - We add our battle arena postion as offset to the other users position networkPosition = (Vector3)stream.ReceiveNext() + battleArenaGameObject.transform.position; networkRotation = (Quaternion)stream.ReceiveNext(); if (isTeleportEnabled) { // If the distance between local & network position is higher than // our teleport threshold, teleport! if (Vector3.Distance(rb.position, networkPosition) > teleportIfDistanceGreaterThan) { rb.position = networkPosition; } } // This segment aims to conpensate the lag caused by the network // See https://doc.photonengine.com/en-us/pun/v2/gameplay/lagcompensation if (synchronizeVelocity || synchronizeAngularVelocity) { // PhotonNetwork = Time accross all devices synced (server time) // SentServerTime = Time where information hads been sent float lag = Mathf.Abs((float)(PhotonNetwork.Time - info.SentServerTime)); if (synchronizeVelocity) { rb.velocity = (Vector3)stream.ReceiveNext(); // Note: The velocity is in meters per second // Timing it by the lag reduces the disrepency networkPosition += rb.velocity * lag; // This distance represent the difference between local position & network position distance = Vector3.Distance(rb.position, networkPosition); } if (synchronizeAngularVelocity) { rb.angularVelocity = (Vector3)stream.ReceiveNext(); networkRotation = Quaternion.Euler(rb.angularVelocity * lag) * networkRotation; angle = Quaternion.Angle(rb.rotation, networkRotation); } } } }
public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) { }
/// <summary> /// /// </summary> /// <param name="info"></param> public override void OnPhotonInstantiate(PhotonMessageInfo info) { bl_EventHandler.OnPhotonInstantiate(info); }
//----------------------------------------------------------------------------------------------- public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) { if (stream.IsWriting) { //플레이어 이름 for (int i = 0; i < playerName.Count; i++) { if (i > playerName.Count - 1) { continue; } stream.SendNext(playerName[i]); } //HP 동기화 for (int i = 0; i < playerHp.Count; i++) { if (i > playerHp.Count - 1) { continue; } stream.SendNext(playerHp[i]); } //킬수 동기화 for (int i = 0; i < playerKill.Count; i++) { if (i > playerKill.Count - 1) { continue; } stream.SendNext(playerKill[i]); } //죽은 횟수 동기화 for (int i = 0; i < playerDead.Count; i++) { if (i > playerDead.Count - 1) { continue; } stream.SendNext(playerDead[i]); } //나를 누가 죽였는지 동기화 for (int i = 0; i < whoPlayerDied.Count; i++) { if (i > whoPlayerDied.Count - 1) { continue; } stream.SendNext(whoPlayerDied[i]); } //내가 누구를 죽였는지 동기화 for (int i = 0; i < whoPlayerKilled.Count; i++) { if (i > whoPlayerKilled.Count - 1) { continue; } stream.SendNext(whoPlayerKilled[i]); } //Dead True/False Check for (int i = 0; i < isPlayerKill.Count; i++) { if (i > isPlayerKill.Count - 1) { continue; } stream.SendNext(isPlayerKill[i]); } //Kill True/False Check for (int i = 0; i < isPlayerDead.Count; i++) { if (i > isPlayerDead.Count - 1) { continue; } stream.SendNext(isPlayerDead[i]); } } //동기화한것들 클라이언트들에게 넘겨주기 else { for (int i = 0; i < playerName.Count; i++) { if (i > playerName.Count - 1) { continue; } playerName[i] = (string)stream.ReceiveNext(); } for (int i = 0; i < playerHp.Count; i++) { if (i > playerHp.Count - 1) { continue; } playerHp[i] = (int)stream.ReceiveNext(); } for (int i = 0; i < playerKill.Count; i++) { if (i > playerKill.Count - 1) { continue; } playerKill[i] = (int)stream.ReceiveNext(); } for (int i = 0; i < playerDead.Count; i++) { if (i > playerDead.Count - 1) { continue; } playerDead[i] = (int)stream.ReceiveNext(); } for (int i = 0; i < whoPlayerDied.Count; i++) { if (i > whoPlayerDied.Count - 1) { continue; } whoPlayerDied[i] = (int)stream.ReceiveNext(); } for (int i = 0; i < whoPlayerKilled.Count; i++) { if (i > whoPlayerKilled.Count - 1) { continue; } whoPlayerKilled[i] = (int)stream.ReceiveNext(); } for (int i = 0; i < isPlayerKill.Count; i++) { if (i > isPlayerKill.Count - 1) { continue; } isPlayerKill[i] = (bool)stream.ReceiveNext(); } for (int i = 0; i < isPlayerDead.Count; i++) { if (i > isPlayerDead.Count - 1) { continue; } isPlayerDead[i] = (bool)stream.ReceiveNext(); } } }
protected internal void SerializeComponent(Component component, PhotonStream stream, PhotonMessageInfo info) { if (component == null) { return; } if (component is MonoBehaviour) { ExecuteComponentOnSerialize(component, stream, info); } else if (component is Transform) { Transform trans = (Transform)component; switch (this.onSerializeTransformOption) { case OnSerializeTransform.All: stream.SendNext(trans.localPosition); stream.SendNext(trans.localRotation); stream.SendNext(trans.localScale); break; case OnSerializeTransform.OnlyPosition: stream.SendNext(trans.localPosition); break; case OnSerializeTransform.OnlyRotation: stream.SendNext(trans.localRotation); break; case OnSerializeTransform.OnlyScale: stream.SendNext(trans.localScale); break; case OnSerializeTransform.PositionAndRotation: stream.SendNext(trans.localPosition); stream.SendNext(trans.localRotation); break; } } else if (component is Rigidbody) { Rigidbody rigidB = (Rigidbody)component; switch (this.onSerializeRigidBodyOption) { case OnSerializeRigidBody.All: stream.SendNext(rigidB.velocity); stream.SendNext(rigidB.angularVelocity); break; case OnSerializeRigidBody.OnlyAngularVelocity: stream.SendNext(rigidB.angularVelocity); break; case OnSerializeRigidBody.OnlyVelocity: stream.SendNext(rigidB.velocity); break; } } else if (component is Rigidbody2D) { Rigidbody2D rigidB = (Rigidbody2D)component; switch (this.onSerializeRigidBodyOption) { case OnSerializeRigidBody.All: stream.SendNext(rigidB.velocity); stream.SendNext(rigidB.angularVelocity); break; case OnSerializeRigidBody.OnlyAngularVelocity: stream.SendNext(rigidB.angularVelocity); break; case OnSerializeRigidBody.OnlyVelocity: stream.SendNext(rigidB.velocity); break; } } else { Debug.LogError("Observed type is not serializable: " + component.GetType()); } }
private void FireProjectile(Vector3 origin, float angle, PhotonMessageInfo info) { int timestamp = info.SentServerTimestamp; projectileManager.Fire(timestamp, photonView.OwnerActorNr, origin, angle, timestamp); }
protected internal void ExecuteComponentOnSerialize(Component component, PhotonStream stream, PhotonMessageInfo info) { IPunObservable observable = component as IPunObservable; if (observable != null) { observable.OnPhotonSerializeView(stream, info); } else if (component != null) { MethodInfo method = null; bool found = this.m_OnSerializeMethodInfos.TryGetValue(component, out method); if (!found) { bool foundMethod = NetworkingPeer.GetMethod(component as MonoBehaviour, PhotonNetworkingMessage.OnPhotonSerializeView.ToString(), out method); if (foundMethod == false) { Debug.LogError("The observed monobehaviour (" + component.name + ") of this PhotonView does not implement OnPhotonSerializeView()!"); method = null; } this.m_OnSerializeMethodInfos.Add(component, method); } if (method != null) { method.Invoke(component, new object[] { stream, info }); } } }
public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) { throw new System.NotImplementedException(); }
protected internal void DeserializeComponent(Component component, PhotonStream stream, PhotonMessageInfo info) { if (component == null) { return; } // Use incoming data according to observed type if (component is MonoBehaviour) { ExecuteComponentOnSerialize(component, stream, info); } else if (component is Transform) { Transform trans = (Transform)component; switch (this.onSerializeTransformOption) { case OnSerializeTransform.All: trans.localPosition = (Vector3)stream.ReceiveNext(); trans.localRotation = (Quaternion)stream.ReceiveNext(); trans.localScale = (Vector3)stream.ReceiveNext(); break; case OnSerializeTransform.OnlyPosition: trans.localPosition = (Vector3)stream.ReceiveNext(); break; case OnSerializeTransform.OnlyRotation: trans.localRotation = (Quaternion)stream.ReceiveNext(); break; case OnSerializeTransform.OnlyScale: trans.localScale = (Vector3)stream.ReceiveNext(); break; case OnSerializeTransform.PositionAndRotation: trans.localPosition = (Vector3)stream.ReceiveNext(); trans.localRotation = (Quaternion)stream.ReceiveNext(); break; } } else if (component is Rigidbody) { Rigidbody rigidB = (Rigidbody)component; switch (this.onSerializeRigidBodyOption) { case OnSerializeRigidBody.All: rigidB.velocity = (Vector3)stream.ReceiveNext(); rigidB.angularVelocity = (Vector3)stream.ReceiveNext(); break; case OnSerializeRigidBody.OnlyAngularVelocity: rigidB.angularVelocity = (Vector3)stream.ReceiveNext(); break; case OnSerializeRigidBody.OnlyVelocity: rigidB.velocity = (Vector3)stream.ReceiveNext(); break; } } else if (component is Rigidbody2D) { Rigidbody2D rigidB = (Rigidbody2D)component; switch (this.onSerializeRigidBodyOption) { case OnSerializeRigidBody.All: rigidB.velocity = (Vector2)stream.ReceiveNext(); rigidB.angularVelocity = (float)stream.ReceiveNext(); break; case OnSerializeRigidBody.OnlyAngularVelocity: rigidB.angularVelocity = (float)stream.ReceiveNext(); break; case OnSerializeRigidBody.OnlyVelocity: rigidB.velocity = (Vector2)stream.ReceiveNext(); break; } } else { Debug.LogError("Type of observed is unknown when receiving."); } }
/// <summary> /// Essentially makes the PV of the character have a way to obtain the gameObject /// </summary> /// <param name="info"></param> public override void OnPhotonInstantiate(PhotonMessageInfo info) { //Assign this gameObject to player called instantiate the prefab info.sender.TagObject = this.gameObject; }
/// <summary> /// Photon Callback method. Called after Gun has been instantiated on network. /// </summary> /// <param name="info"></param> public void OnPhotonInstantiate(PhotonMessageInfo info) { if (DEBUG && DEBUG_OnPhotonInstantiate) { Debug.LogFormat("Gun: OnPhotonInstantiate() info.photonView.ViewID = {0}", info.photonView.ViewID); } // *** // For players entering a room late... // *** // If this gun has a registered owner (player) in the room's CustomProperties... if (PhotonNetwork.CurrentRoom.CustomProperties.TryGetValue(gameObject.GetComponent <PhotonView>().ViewID.ToString(), out object gunOwnerNickName)) { if (DEBUG && DEBUG_MakeOwnerPickupGun) { Debug.LogFormat("Gun: MakeOwnerPickupGun() (string)gunOwnerNickNameVal = {0}", (string)gunOwnerNickName); } // Go through the list of all the players... (*** This loop would probably be unnecessary if we used actor numbers instead of nicknames for gun ownership) foreach (Player player in PhotonNetwork.PlayerList) { // If we found the player who is the gunOwner... if (player.NickName.Equals(gunOwnerNickName)) { // Save a reference to the gun owner and the gun View ID Player gunOwner = player; int gunViewID = gameObject.GetComponent <PhotonView>().ViewID; if (DEBUG && DEBUG_MakeOwnerPickupGun) { Debug.LogFormat("Gun: MakeOwnerPickupGun() Making player {0} PICKUP gun {1} with ViewID = {2}", gunOwnerNickName, this.ToString(), gunViewID); } bool playerHasBeenInstantiated = ((GameObject)gunOwner.TagObject) != null; // If player has been instantiated before the gun has been instantiated... if (playerHasBeenInstantiated) { // Make gunOwner pick up this gun ((GameObject)gunOwner.TagObject).GetComponent <PlayerManager>().PickUpGun(gunViewID); // If this player has registered an active gun in the player's CustomProperties... if (gunOwner.CustomProperties.TryGetValue(PlayerManager.KEY_ACTIVE_GUN, out object gunViewIDObject)) { // If this gun is the active gun (for the player who owns this gun)... if (gunViewID == Convert.ToInt32(gunViewIDObject)) { if (DEBUG && DEBUG_MakeOwnerPickupGun) { Debug.LogFormat("Gun: MakeOwnerPickupGun() Making player {0} SETACTIVE gun {1} with ViewID = {2}", gunOwnerNickName, this.ToString(), gunViewID); } // Make gunOwner set this gun as the active gun ((GameObject)gunOwner.TagObject).GetComponent <PlayerManager>().SetActiveGun(gunViewID); } } } // We've found the player who owns this gun and dealt with everything so don't keep looking through the list of players.. break; } } } }
public virtual void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) { Loger.LogFormat("OnPhotonSerializeView stream.isWriting={0}", stream.isWriting); }
public void PunPickupSimple(PhotonMessageInfo msgInfo) { }
void SyncColors(string name, string color, PhotonMessageInfo info) { switch (name) { case "Head": part = head; break; case "Body Outer": part = body; break; case "Center Piece": part = centerpiece; break; case "Body Detail": part = bodydetail; break; case "Right Shoulder Pad": part = rightshoulder; break; case "Left Shoulder Pad": part = leftshoulder; break; case "Right Arm 1": part = rightarm; break; case "Right Cuff": part = rightarmcuff; break; case "Left Arm 1": part = leftarm; break; case "Left Cuff": part = leftarmcuff; break; case "Player(Clone)": part = bottom; break; } Renderer[] renderers = part.GetComponentsInChildren <Renderer> (); int length; if (part == bottom) { length = 1; } else { length = renderers.Length; } for (int n = 0; n < length; n++) { if (color == "Red ") { renderers [n].material = red_Color; } if (color == "Orange ") { renderers [n].material = orange_Color; } if (color == "Yellow ") { renderers [n].material = yellow_Color; } if (color == "Green ") { renderers [n].material = green_Color; } if (color == "Blue ") { renderers [n].material = blue_Color; } if (color == "Purple ") { renderers [n].material = purple_Color; } if (color == "Pink ") { renderers [n].material = pink_Color; } if (color == "Gray ") { renderers [n].material = gray_Color; } if (color == "White ") { renderers [n].material = white_Color; } if (color == "Black ") { renderers [n].material = black_Color; } } }
public void OnPhotonSerializeView(Quaternion currentRotation, PhotonStream stream, PhotonMessageInfo info) { if (m_Model.SynchronizeEnabled == false) { return; } if (stream.isWriting == true) { stream.SendNext(currentRotation); m_NetworkRotation = currentRotation; } else { m_NetworkRotation = (Quaternion)stream.ReceiveNext(); } }
public void LoadScene(string sceneName, PhotonMessageInfo info) { PhotonNetwork.LoadLevel(sceneName); }
public virtual void OnPhotonInstantiate(PhotonMessageInfo info) { Loger.LogFormat("[OnPhotonInstantiate]"); }
void IPunCallbacks.OnPhotonInstantiate(PhotonMessageInfo info) { }
//ON PHOTON SERIALIZE VIEW protected virtual void OnPhotonSerializeView(PhotonStream _stream, PhotonMessageInfo _messageInfo) { }
public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) { if (stream.IsWriting) { stream.SendNext(playerInfo.moved); stream.SendNext(playerInfo.attacked); stream.SendNext(playerInfo.slowed); stream.SendNext(playerInfo.shocked); stream.SendNext(playerInfo.hasted); stream.SendNext(playerInfo.stunned); stream.SendNext(playerInfo.evading); stream.SendNext(playerInfo.cardsPlayed); stream.SendNext(playerInfo.turnDistanceTraveled); stream.SendNext(playerInfo.stillStandingTurns); stream.SendNext(playerInfo.nextAtkSlows); stream.SendNext(playerInfo.nextAtkShocks); stream.SendNext(playerInfo.nextFreeMove); stream.SendNext(playerInfo.nextFreeBasic); //stream.SendNext(playerInfo.maxHp); stream.SendNext(playerInfo.health); playerManager.UpdateAHBText(); //stream.SendNext(playerInfo.attack); stream.SendNext(playerInfo.block); playerManager.UpdateAHBText(); stream.SendNext(playerInfo.resolve); //stream.SendNext(playerInfo.basicRange); stream.SendNext(playerInfo.basicIsStraight); stream.SendNext(playerInfo.basicIsPiercing); stream.SendNext(playerInfo.moveDist); stream.SendNext(playerInfo.addedMoveDist); stream.SendNext(playerInfo.moveIsCharge); stream.SendNext(playerInfo.addedBasicRange); stream.SendNext(playerInfo.basicRangeMultiplier); stream.SendNext(playerInfo.setBasicRange); stream.SendNext(playerInfo.addedBasicAttack); stream.SendNext(playerInfo.basicAttackMultiplier); stream.SendNext(playerInfo.setBasicAttack); stream.SendNext(playerInfo.addedDamage); stream.SendNext(playerInfo.damageMultiplier); stream.SendNext(playerInfo.setDamage); stream.SendNext(playerInfo.addedWeaponDamage); stream.SendNext(playerInfo.weaponDamageMultiplier); } else { playerInfo.moved = (bool)stream.ReceiveNext(); playerInfo.attacked = (bool)stream.ReceiveNext(); playerInfo.slowed = (int)stream.ReceiveNext(); playerInfo.shocked = (int)stream.ReceiveNext(); playerInfo.hasted = (int)stream.ReceiveNext(); playerInfo.stunned = (int)stream.ReceiveNext(); playerInfo.evading = (int)stream.ReceiveNext(); playerInfo.cardsPlayed = (int)stream.ReceiveNext(); playerInfo.turnDistanceTraveled = (int)stream.ReceiveNext(); playerInfo.stillStandingTurns = (int)stream.ReceiveNext(); playerInfo.nextAtkSlows = (bool)stream.ReceiveNext(); playerInfo.nextAtkShocks = (bool)stream.ReceiveNext(); playerInfo.nextFreeMove = (bool)stream.ReceiveNext(); playerInfo.nextFreeBasic = (bool)stream.ReceiveNext(); //playerInfo.maxHp = (int)stream.ReceiveNext(); playerInfo.health = (int)stream.ReceiveNext(); playerManager.UpdateAHBText(); //playerInfo.attack = (int)stream.ReceiveNext(); playerInfo.block = (int)stream.ReceiveNext(); playerManager.UpdateAHBText(); playerInfo.resolve = (int)stream.ReceiveNext(); // playerInfo.basicRange = (int)stream.ReceiveNext(); playerInfo.basicIsStraight = (bool)stream.ReceiveNext(); playerInfo.basicIsPiercing = (bool)stream.ReceiveNext(); playerInfo.moveDist = (int)stream.ReceiveNext(); playerInfo.addedMoveDist = (int)stream.ReceiveNext(); playerInfo.moveIsCharge = (bool)stream.ReceiveNext(); int abr = (int)stream.ReceiveNext(); if (playerInfo.addedBasicRange != abr) { playerInfo.addedBasicRange = abr; playerManager.SetAllAttackableOutlines(); } float brm = (float)stream.ReceiveNext(); if (playerInfo.basicRangeMultiplier != brm) { playerInfo.basicRangeMultiplier = brm; playerManager.SetAllAttackableOutlines(); } int sbr = (int)stream.ReceiveNext(); if (playerInfo.setBasicRange != sbr) { playerInfo.setBasicRange = sbr; playerManager.SetAllAttackableOutlines(); } playerInfo.addedBasicAttack = (int)stream.ReceiveNext(); playerInfo.basicAttackMultiplier = (float)stream.ReceiveNext(); playerInfo.setBasicAttack = (int)stream.ReceiveNext(); playerInfo.addedDamage = (int)stream.ReceiveNext(); playerInfo.damageMultiplier = (float)stream.ReceiveNext(); playerInfo.setDamage = (int)stream.ReceiveNext(); playerInfo.addedWeaponDamage = (int)stream.ReceiveNext(); playerInfo.weaponDamageMultiplier = (float)stream.ReceiveNext(); } }
public void SetSize(string settings, PhotonMessageInfo info) { if (!info.sender.isMasterClient) { return; } string[] array = settings.Split(','); if (array.Length <= 15) { return; } float a = 1f; if (array[2] != "default") { if (array[2].StartsWith("transparent")) { if (float.TryParse(array[2].Substring(11), out float result)) { a = result; } Renderer[] componentsInChildren = gameObject.GetComponentsInChildren <Renderer>(); foreach (Renderer renderer in componentsInChildren) { renderer.material = (Material)FengGameManagerMKII.RCAssets.Load("transparent"); if (Convert.ToSingle(array[10]) != 1f || Convert.ToSingle(array[11]) != 1f) { renderer.material.mainTextureScale = new Vector2(renderer.material.mainTextureScale.x * Convert.ToSingle(array[10]), renderer.material.mainTextureScale.y * Convert.ToSingle(array[11])); } } } else { Renderer[] componentsInChildren = gameObject.GetComponentsInChildren <Renderer>(); foreach (Renderer renderer in componentsInChildren) { if (!renderer.name.Contains("Line Renderer")) { renderer.material = (Material)FengGameManagerMKII.RCAssets.Load(array[2]); if (Convert.ToSingle(array[10]) != 1f || Convert.ToSingle(array[11]) != 1f) { renderer.material.mainTextureScale = new Vector2(renderer.material.mainTextureScale.x * Convert.ToSingle(array[10]), renderer.material.mainTextureScale.y * Convert.ToSingle(array[11])); } } } } } float num = gameObject.transform.localScale.x * Convert.ToSingle(array[3]); num -= 0.001f; float y = gameObject.transform.localScale.y * Convert.ToSingle(array[4]); float z = gameObject.transform.localScale.z * Convert.ToSingle(array[5]); gameObject.transform.localScale = new Vector3(num, y, z); if (!(array[6] != "0")) { return; } Color color = new Color(Convert.ToSingle(array[7]), Convert.ToSingle(array[8]), Convert.ToSingle(array[9]), a); MeshFilter[] componentsInChildren2 = gameObject.GetComponentsInChildren <MeshFilter>(); foreach (MeshFilter meshFilter in componentsInChildren2) { Mesh mesh = meshFilter.mesh; Color[] array2 = new Color[mesh.vertexCount]; for (int j = 0; j < mesh.vertexCount; j++) { array2[j] = color; } mesh.colors = array2; } }
protected override void RpcDoShootEffect(Vector3 pos, Quaternion rot, PhotonMessageInfo pmi) { BulletTrailPrefab.GetComponent <BulletMovment>().own = PlayersManager.FindPlayer(pmi.sender).gameObject.GetComponent <TankEvolution>().HullGameObject; Instantiate(BulletTrailPrefab, pos, rot); }
public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) { if (stream.IsWriting) { stream.SendNext(playerNum); stream.SendNext(playerName); stream.SendNext(playerHP); //stream.SendNext(playerHPText); stream.SendNext(startingPlayerHP); stream.SendNext(maxPlayerHP); stream.SendNext(playerState); stream.SendNext(selectedAction); stream.SendNext(rawDeckData); //stream.SendNext(deck); //stream.SendNext(hand); //stream.SendNext(activeCard); //stream.SendNext(cookBaseCard); //stream.SendNext(cookSpiceCard); //stream.SendNext(playerPlatePanel); //stream.SendNext(bench); //stream.SendNext(discardPile); //stream.SendNext(playerDeckPanel); //stream.SendNext(playerBenchPanel); //stream.SendNext(playerDeckInfo); stream.SendNext(deckFinishedBuilding); for (int i = 0; i < handBools.Length; i++) { stream.SendNext(handBools[i]); } } else { playerNum = (int)stream.ReceiveNext(); playerName = (string)stream.ReceiveNext(); playerHP = (int)stream.ReceiveNext(); //playerHPText = (Text)stream.ReceiveNext(); startingPlayerHP = (int)stream.ReceiveNext(); maxPlayerHP = (int)stream.ReceiveNext(); playerState = (PlayerState)stream.ReceiveNext(); selectedAction = (Action)stream.ReceiveNext(); rawDeckData = (string)stream.ReceiveNext(); //deck = (Stack<Card>)stream.ReceiveNext(); //hand = (Card[])stream.ReceiveNext(); //activeCard = (Card)stream.ReceiveNext(); //cookBaseCard = (Card)stream.ReceiveNext(); //cookSpiceCard = (Card)stream.ReceiveNext(); //playerPlatePanel = (GameObject)stream.ReceiveNext(); //bench = (Card[])stream.ReceiveNext(); //discardPile = (Stack<Card>)stream.ReceiveNext(); //playerDeckPanel = (GameObject)stream.ReceiveNext(); //playerBenchPanel = (GameObject)stream.ReceiveNext(); //playerDeckInfo = (Text)stream.ReceiveNext(); deckFinishedBuilding = (bool)stream.ReceiveNext(); for (int i = 0; i < handBools.Length; i++) { handBools[i] = (bool)stream.ReceiveNext(); } } }
private void changeDoor(PhotonMessageInfo info) { door_broken.SetActive(true); door_closed.SetActive(false); }
public virtual void OnPhotonInstantiate(PhotonMessageInfo info) { Debug.Log("OnPhotonInstantiate " + info); }
private void RoomBusy(PhotonMessageInfo messageInfo) { RoomBusy(); }
public void ApplyParametersRPC(string expression, float Xmin, float Xmax, float Ymin, float Ymax, int n, PhotonMessageInfo info) { FunctionMeshManager.expr = expression; FunctionMeshManager.xMin = Xmin; FunctionMeshManager.xMax = Xmax; FunctionMeshManager.zMin = Ymin; FunctionMeshManager.zMax = Ymax; FunctionMeshManager.n = n; FunctionMeshManager.RecalculateMesh(); }