From 24e1e7c27b3b637fabf36b492b3cbbbdf18ef5bf Mon Sep 17 00:00:00 2001 From: in0finite Date: Thu, 2 Jul 2020 01:02:43 +0200 Subject: [PATCH] remove unused code --- Assets/Scripts/Networking/NetworkRigidBody.cs | 117 ------------------ 1 file changed, 117 deletions(-) diff --git a/Assets/Scripts/Networking/NetworkRigidBody.cs b/Assets/Scripts/Networking/NetworkRigidBody.cs index a3927e42..15bc1c71 100644 --- a/Assets/Scripts/Networking/NetworkRigidBody.cs +++ b/Assets/Scripts/Networking/NetworkRigidBody.cs @@ -8,11 +8,6 @@ namespace SanAndreasUnity.Net { public Rigidbody Rigidbody { get; set; } - Vector3 m_lastPosition = Vector3.zero; - Vector3 m_lastRotation = Vector3.zero; - Vector3 m_lastVelocity = Vector3.zero; - Vector3 m_lastAngularVelocity = Vector3.zero; - [SyncVar] Vector3 m_net_position = Vector3.zero; [SyncVar] Vector3 m_net_rotation = Vector3.zero; [SyncVar] Vector3 m_net_velocity = Vector3.zero; @@ -77,118 +72,6 @@ namespace SanAndreasUnity.Net this.Rigidbody.angularVelocity = m_net_angularVelocity; } - /* - public override void OnDeserialize(NetworkReader reader, bool initialState) - { - bool hasRigidBody = this.Rigidbody != null; - - byte bitfield = reader.ReadByte(); - - //Vector3 pos = Vector3.zero; - //Vector3 rot = Vector3.zero; - //Vector3 vel = Vector3.zero; - //Vector3 angVel = Vector3.zero; - - if ((bitfield & 1) != 0) - { - Vector3 pos = reader.ReadVector3(); - if (hasRigidBody) - this.Rigidbody.MovePosition(pos); - } - - if ((bitfield & 2) != 0) - { - Vector3 rot = reader.ReadVector3(); - if (hasRigidBody) - this.Rigidbody.MoveRotation(Quaternion.Euler(rot)); - } - - if ((bitfield & 4) != 0) - { - Vector3 vel = reader.ReadVector3(); - if (hasRigidBody) - this.Rigidbody.velocity = vel; - } - - if ((bitfield & 8) != 0) - { - Vector3 angVel = reader.ReadVector3(); - if (hasRigidBody) - this.Rigidbody.angularVelocity = angVel; - } - - } - - public override bool OnSerialize(NetworkWriter writer, bool initialState) - { - if (null == this.Rigidbody) - return false; - - Vector3 pos = this.Rigidbody.position; - Vector3 rot = this.Rigidbody.rotation.eulerAngles; - Vector3 vel = this.Rigidbody.velocity; - Vector3 angVel = this.Rigidbody.angularVelocity; - - if (initialState) - { - writer.Write((byte) byte.MaxValue); - writer.Write(pos); - writer.Write(rot); - writer.Write(vel); - writer.Write(angVel); - - m_lastPosition = pos; - m_lastRotation = rot; - m_lastVelocity = vel; - m_lastAngularVelocity = angVel; - - return true; - } - - int startingWriterPosition = writer.Position; - writer.Write((byte)0); - - byte bitfield = 0; - - if (pos != m_lastPosition) - { - m_lastPosition = pos; - writer.Write(pos); - bitfield |= 1; - } - - if (rot != m_lastRotation) - { - m_lastRotation = rot; - writer.Write(rot); - bitfield |= 2; - } - - if (vel != m_lastVelocity) - { - m_lastVelocity = vel; - writer.Write(vel); - bitfield |= 4; - } - - if (angVel != m_lastAngularVelocity) - { - m_lastAngularVelocity = angVel; - writer.Write(angVel); - bitfield |= 8; - } - - int endWriterPosition = writer.Position; - - writer.Position = startingWriterPosition; - writer.Write(bitfield); - - writer.Position = endWriterPosition; - - return bitfield != 0; // is dirty - } - */ - } }