UnityEngine.Networking.NetworkTransform.SerializeMode2D C# (CSharp) Method

SerializeMode2D() private method

private SerializeMode2D ( NetworkWriter writer ) : void
writer NetworkWriter
return void
        private void SerializeMode2D(NetworkWriter writer)
        {
            if (base.isServer && (this.m_LastClientSyncTime != 0f))
            {
                writer.Write((Vector2) this.m_TargetSyncPosition);
                SerializeVelocity2D(writer, this.m_TargetSyncVelocity, CompressionSyncMode.None);
                if (this.syncRotationAxis != AxisSyncMode.None)
                {
                    float rot = this.m_TargetSyncRotation2D % 360f;
                    if (rot < 0f)
                    {
                        rot += 360f;
                    }
                    SerializeRotation2D(writer, rot, this.rotationSyncCompression);
                }
            }
            else
            {
                writer.Write(this.m_RigidBody2D.position);
                SerializeVelocity2D(writer, this.m_RigidBody2D.velocity, CompressionSyncMode.None);
                if (this.syncRotationAxis != AxisSyncMode.None)
                {
                    float num2 = this.m_RigidBody2D.rotation % 360f;
                    if (num2 < 0f)
                    {
                        num2 += 360f;
                    }
                    SerializeRotation2D(writer, num2, this.rotationSyncCompression);
                }
            }
            if (this.m_SyncSpin)
            {
                SerializeSpin2D(writer, this.m_RigidBody2D.angularVelocity, this.rotationSyncCompression);
            }
            this.m_PrevPosition = (Vector3) this.m_RigidBody2D.position;
            this.m_PrevRotation = base.transform.rotation;
            this.m_PrevVelocity = this.m_RigidBody2D.velocity.sqrMagnitude;
        }