public void Update() { if (base.networkView.isMine) { DedicatedServer.CheckPlayer(base.networkView.owner, "NetworkInterpolation @Update"); this.position = base.transform.position; this.rotation = base.transform.rotation; if ((double)Mathf.Abs(this.position.x - this.lastPosition.x) > 0.2 || (double)Mathf.Abs(this.position.y - this.lastPosition.y) > 0.2 || (double)Mathf.Abs(this.position.z - this.lastPosition.z) > 0.2) { this.lastPosition = this.position; base.networkView.RPC("tellPosition", RPCMode.Others, new object[] { this.position }); } if (Mathf.Abs(this.rotation.eulerAngles.x - this.lastRotation.eulerAngles.x) > 5f || Mathf.Abs(this.rotation.eulerAngles.y - this.lastRotation.eulerAngles.y) > 5f || Mathf.Abs(this.rotation.eulerAngles.z - this.lastRotation.eulerAngles.z) > 5f) { this.lastRotation = this.rotation; base.networkView.RPC("tellRotation", RPCMode.Others, new object[] { this.rotation }); } } else if (base.transform.parent != null && base.transform.parent.name == "models") { this.lastPosition = base.transform.position; this.lastRotation = base.transform.rotation; if ((double)Mathf.Abs(this.position.x - this.lastPosition.x) > 0.2 || (double)Mathf.Abs(this.position.y - this.lastPosition.y) > 0.2 || (double)Mathf.Abs(this.position.z - this.lastPosition.z) > 0.2 || Mathf.Abs(this.rotation.eulerAngles.x - this.lastRotation.eulerAngles.x) > 5f || Mathf.Abs(this.rotation.eulerAngles.y - this.lastRotation.eulerAngles.y) > 5f || Mathf.Abs(this.rotation.eulerAngles.z - this.lastRotation.eulerAngles.z) > 5f) { base.transform.position = Vector3.Lerp(this.lastPosition, this.position, (float)NetworkInterpolation.INTERPOLATION_RATE * Time.deltaTime); base.transform.rotation = Quaternion.Lerp(this.lastRotation, this.rotation, (float)NetworkInterpolation.INTERPOLATION_RATE * Time.deltaTime); } } }
public void askAllPlayer(NetworkPlayer player) { if (!DedicatedServer.CheckPlayer(player, "Player.cs @askAllPlayer")) { return; } StartCoroutine("introduceSelf", player); }
public void loadPositionFromSerial(NetworkPlayer player, string serial) { if (serial != string.Empty) { string[] strArrays = Packer.unpack(serial, ';'); Vector3 vector3 = new Vector3(float.Parse(strArrays[0]), float.Parse(strArrays[1]), float.Parse(strArrays[2])); DedicatedServer.CheckPlayer(player, "SpawnPlayers.cs @loadPositionFromSerial"); if (player != Network.player) { base.networkView.RPC("tellPosition", player, new object[] { vector3, float.Parse(strArrays[3]) }); } else { this.tellPosition(vector3, float.Parse(strArrays[3])); } } else { Transform spawnPoint = SpawnPlayers.getSpawnPoint(player, true); if (player != Network.player) { NetworkView networkView = base.networkView; object[] objArray = new object[] { spawnPoint.position, null }; Vector3 vector31 = spawnPoint.rotation.eulerAngles; objArray[1] = vector31.y + 90f; networkView.RPC("tellPosition", player, objArray); } else { Vector3 vector32 = spawnPoint.position; Vector3 vector33 = spawnPoint.rotation.eulerAngles; this.tellPosition(vector32, vector33.y + 90f); } } }