// Token: 0x0600108D RID: 4237 RVA: 0x00075570 File Offset: 0x00073770 private void Load() { if (this.m_nview == null) { return; } DateTime now = DateTime.Now; ZLog.Log("Loading dungeon"); ZDO zdo = this.m_nview.GetZDO(); int @int = zdo.GetInt("rooms", 0); for (int i = 0; i < @int; i++) { string text = "room" + i.ToString(); int int2 = zdo.GetInt(text, 0); Vector3 vec = zdo.GetVec3(text + "_pos", Vector3.zero); Quaternion quaternion = zdo.GetQuaternion(text + "_rot", Quaternion.identity); DungeonDB.RoomData room = DungeonDB.instance.GetRoom(int2); if (room == null) { ZLog.LogWarning("Missing room:" + int2); } else { this.PlaceRoom(room, vec, quaternion, null, ZoneSystem.SpawnMode.Client); } } ZLog.Log("Dungeon loaded " + @int); ZLog.Log("Dungeon load time " + (DateTime.Now - now).TotalMilliseconds + " ms"); }
// Token: 0x060009D6 RID: 2518 RVA: 0x000477E4 File Offset: 0x000459E4 private void ClientSync(float dt) { ZDO zdo = this.m_nview.GetZDO(); if (zdo.IsOwner()) { return; } int frameCount = Time.frameCount; if (this.m_lastUpdateFrame == frameCount) { return; } this.m_lastUpdateFrame = frameCount; if (this.m_isKinematicBody) { if (this.m_syncPosition) { Vector3 vector = zdo.GetPosition(); if (Vector3.Distance(this.m_body.position, vector) > 5f) { this.m_body.position = vector; } else { if (Vector3.Distance(this.m_body.position, vector) > 0.01f) { vector = Vector3.Lerp(this.m_body.position, vector, 0.2f); } this.m_body.MovePosition(vector); } } if (this.m_syncRotation) { Quaternion rotation = zdo.GetRotation(); if (Quaternion.Angle(this.m_body.rotation, rotation) > 45f) { this.m_body.rotation = rotation; } else { this.m_body.MoveRotation(rotation); } } } else { if (this.m_syncPosition) { this.SyncPosition(zdo, dt); } if (this.m_syncRotation) { Quaternion rotation2 = zdo.GetRotation(); if (Quaternion.Angle(base.transform.rotation, rotation2) > 0.001f) { base.transform.rotation = Quaternion.Slerp(base.transform.rotation, rotation2, 0.2f); } } if (this.m_body) { this.m_body.useGravity = false; if (this.m_syncBodyVelocity && this.m_nview.HasOwner()) { Vector3 vec = zdo.GetVec3(ZSyncTransform.m_bodyVel, Vector3.zero); Vector3 vec2 = zdo.GetVec3(ZSyncTransform.m_bodyAVel, Vector3.zero); if (vec.magnitude > 0.01f || vec2.magnitude > 0.01f) { this.m_body.velocity = vec; this.m_body.angularVelocity = vec2; } else { this.m_body.Sleep(); } } else if (!this.m_body.IsSleeping()) { this.m_body.velocity = Vector3.zero; this.m_body.angularVelocity = Vector3.zero; this.m_body.Sleep(); } } } if (this.m_syncScale) { Vector3 vec3 = zdo.GetVec3(ZSyncTransform.m_scaleHash, base.transform.localScale); base.transform.localScale = vec3; } }
// Token: 0x060009D5 RID: 2517 RVA: 0x000475AC File Offset: 0x000457AC private void SyncPosition(ZDO zdo, float dt) { if (this.m_characterParentSync && zdo.HasOwner()) { ZDOID zdoid = zdo.GetZDOID(ZSyncTransform.m_parentIDHash); if (!zdoid.IsNone()) { GameObject gameObject = ZNetScene.instance.FindInstance(zdoid); if (gameObject) { ZSyncTransform component = gameObject.GetComponent <ZSyncTransform>(); if (component) { component.ClientSync(dt); } Vector3 vector = zdo.GetVec3(ZSyncTransform.m_relPos, Vector3.zero); Vector3 vec = zdo.GetVec3(ZSyncTransform.m_velHash, Vector3.zero); if (zdo.m_dataRevision != this.m_posRevision) { this.m_posRevision = zdo.m_dataRevision; this.m_targetPosTimer = 0f; } this.m_targetPosTimer += dt; this.m_targetPosTimer = Mathf.Min(this.m_targetPosTimer, 2f); vector += vec * this.m_targetPosTimer; if (!this.m_haveTempRelPos) { this.m_haveTempRelPos = true; this.m_tempRelPos = vector; } if (Vector3.Distance(this.m_tempRelPos, vector) > 0.001f) { this.m_tempRelPos = Vector3.Lerp(this.m_tempRelPos, vector, 0.2f); vector = this.m_tempRelPos; } Vector3 vector2 = gameObject.transform.TransformPoint(vector); if (Vector3.Distance(base.transform.position, vector2) > 0.001f) { base.transform.position = vector2; } return; } } } this.m_haveTempRelPos = false; Vector3 vector3 = zdo.GetPosition(); if (zdo.m_dataRevision != this.m_posRevision) { this.m_posRevision = zdo.m_dataRevision; this.m_targetPosTimer = 0f; } if (zdo.HasOwner()) { this.m_targetPosTimer += dt; this.m_targetPosTimer = Mathf.Min(this.m_targetPosTimer, 2f); Vector3 vec2 = zdo.GetVec3(ZSyncTransform.m_velHash, Vector3.zero); vector3 += vec2 * this.m_targetPosTimer; } float num = Vector3.Distance(base.transform.position, vector3); if (num > 0.001f) { base.transform.position = ((num < 5f) ? Vector3.Lerp(base.transform.position, vector3, 0.2f) : vector3); } }