private void UnserializeModeCharacterController(NetworkReader reader, bool initialState)
{
if (base.hasAuthority)
{
reader.ReadVector3();
if (this.syncRotationAxis != AxisSyncMode.None)
{
UnserializeRotation3D(reader, this.syncRotationAxis, this.rotationSyncCompression);
}
}
else
{
if (base.isServer && (this.m_ClientMoveCallback3D != null))
{
Vector3 position = reader.ReadVector3();
Quaternion identity = Quaternion.identity;
if (this.syncRotationAxis != AxisSyncMode.None)
{
identity = UnserializeRotation3D(reader, this.syncRotationAxis, this.rotationSyncCompression);
}
if (this.m_CharacterController == null)
{
return;
}
Vector3 velocity = this.m_CharacterController.velocity;
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();
if (this.syncRotationAxis != AxisSyncMode.None)
{
this.m_TargetSyncRotation3D = UnserializeRotation3D(reader, this.syncRotationAxis, this.rotationSyncCompression);
}
}
if (this.m_CharacterController != null)
{
Vector3 vector3 = this.m_TargetSyncPosition - base.transform.position;
Vector3 vector4 = (Vector3) (vector3 / this.GetNetworkSendInterval());
this.m_FixedPosDiff = (Vector3) (vector4 * Time.fixedDeltaTime);
if (base.isServer && !base.isClient)
{
base.transform.position = this.m_TargetSyncPosition;
base.transform.rotation = this.m_TargetSyncRotation3D;
}
else if (this.GetNetworkSendInterval() == 0f)
{
base.transform.position = this.m_TargetSyncPosition;
if (this.syncRotationAxis != AxisSyncMode.None)
{
base.transform.rotation = this.m_TargetSyncRotation3D;
}
}
else
{
Vector3 vector5 = base.transform.position - this.m_TargetSyncPosition;
if (vector5.magnitude > this.snapThreshold)
{
base.transform.position = this.m_TargetSyncPosition;
}
if ((this.interpolateRotation == 0f) && (this.syncRotationAxis != AxisSyncMode.None))
{
base.transform.rotation = this.m_TargetSyncRotation3D;
}
if (this.m_InterpolateMovement == 0f)
{
base.transform.position = this.m_TargetSyncPosition;
}
if (initialState && (this.syncRotationAxis != AxisSyncMode.None))
{
base.transform.rotation = this.m_TargetSyncRotation3D;
}
}
}
}
}