private void UnserializeMode3D(NetworkReader reader, bool initialState)
{
if (base.hasAuthority)
{
reader.ReadVector3();
reader.ReadVector3();
if (this.syncRotationAxis != AxisSyncMode.None)
{
UnserializeRotation3D(reader, this.syncRotationAxis, this.rotationSyncCompression);
}
if (this.syncSpin)
{
UnserializeSpin3D(reader, this.syncRotationAxis, this.rotationSyncCompression);
}
}
else
{
if (base.isServer && (this.m_ClientMoveCallback3D != null))
{
Vector3 position = reader.ReadVector3();
Vector3 velocity = reader.ReadVector3();
Quaternion identity = Quaternion.identity;
if (this.syncRotationAxis != AxisSyncMode.None)
{
identity = UnserializeRotation3D(reader, this.syncRotationAxis, this.rotationSyncCompression);
}
if (!this.m_ClientMoveCallback3D(ref position, ref velocity, ref identity))
{
return;
}
this.m_TargetSyncPosition = position;
this.m_TargetSyncVelocity = velocity;
if (this.syncRotationAxis != AxisSyncMode.None)
{
this.m_TargetSyncRotation3D = identity;
}
}
else
{
this.m_TargetSyncPosition = reader.ReadVector3();
this.m_TargetSyncVelocity = reader.ReadVector3();
if (this.syncRotationAxis != AxisSyncMode.None)
{
this.m_TargetSyncRotation3D = UnserializeRotation3D(reader, this.syncRotationAxis, this.rotationSyncCompression);
}
}
if (this.syncSpin)
{
this.m_TargetSyncAngularVelocity3D = UnserializeSpin3D(reader, this.syncRotationAxis, this.rotationSyncCompression);
}
if (this.m_RigidBody3D != null)
{
if (base.isServer && !base.isClient)
{
this.m_RigidBody3D.MovePosition(this.m_TargetSyncPosition);
this.m_RigidBody3D.MoveRotation(this.m_TargetSyncRotation3D);
this.m_RigidBody3D.velocity = this.m_TargetSyncVelocity;
}
else if (this.GetNetworkSendInterval() == 0f)
{
this.m_RigidBody3D.MovePosition(this.m_TargetSyncPosition);
this.m_RigidBody3D.velocity = this.m_TargetSyncVelocity;
if (this.syncRotationAxis != AxisSyncMode.None)
{
this.m_RigidBody3D.MoveRotation(this.m_TargetSyncRotation3D);
}
if (this.syncSpin)
{
this.m_RigidBody3D.angularVelocity = this.m_TargetSyncAngularVelocity3D;
}
}
else
{
Vector3 vector3 = this.m_RigidBody3D.position - this.m_TargetSyncPosition;
if (vector3.magnitude > this.snapThreshold)
{
this.m_RigidBody3D.position = this.m_TargetSyncPosition;
this.m_RigidBody3D.velocity = this.m_TargetSyncVelocity;
}
if ((this.interpolateRotation == 0f) && (this.syncRotationAxis != AxisSyncMode.None))
{
this.m_RigidBody3D.rotation = this.m_TargetSyncRotation3D;
if (this.syncSpin)
{
this.m_RigidBody3D.angularVelocity = this.m_TargetSyncAngularVelocity3D;
}
}
if (this.m_InterpolateMovement == 0f)
{
this.m_RigidBody3D.position = this.m_TargetSyncPosition;
}
if (initialState && (this.syncRotationAxis != AxisSyncMode.None))
{
this.m_RigidBody3D.rotation = this.m_TargetSyncRotation3D;
}
}
}
}
}