private void OnValidate()
{
if (this.m_Target != null)
{
Transform parent = this.m_Target.parent;
if (parent == null)
{
if (LogFilter.logError)
{
Debug.LogError("NetworkTransformChild target cannot be the root transform.");
}
this.m_Target = null;
return;
}
while (parent.parent != null)
{
parent = parent.parent;
}
this.m_Root = parent.gameObject.GetComponent<NetworkTransform>();
if (this.m_Root == null)
{
if (LogFilter.logError)
{
Debug.LogError("NetworkTransformChild root must have NetworkTransform");
}
this.m_Target = null;
return;
}
}
this.m_ChildIndex = uint.MaxValue;
NetworkTransformChild[] components = this.m_Root.GetComponents<NetworkTransformChild>();
for (uint i = 0; i < components.Length; i++)
{
if (components[i] == this)
{
this.m_ChildIndex = i;
break;
}
}
if (this.m_ChildIndex == uint.MaxValue)
{
if (LogFilter.logError)
{
Debug.LogError("NetworkTransformChild component must be a child in the same hierarchy");
}
this.m_Target = null;
}
if (this.m_SendInterval < 0f)
{
this.m_SendInterval = 0f;
}
if ((this.m_SyncRotationAxis < NetworkTransform.AxisSyncMode.None) || (this.m_SyncRotationAxis > NetworkTransform.AxisSyncMode.AxisXYZ))
{
this.m_SyncRotationAxis = NetworkTransform.AxisSyncMode.None;
}
if (this.movementThreshold < 0f)
{
this.movementThreshold = 0f;
}
if (this.interpolateRotation < 0f)
{
this.interpolateRotation = 0.01f;
}
if (this.interpolateRotation > 1f)
{
this.interpolateRotation = 1f;
}
if (this.interpolateMovement < 0f)
{
this.interpolateMovement = 0.01f;
}
if (this.interpolateMovement > 1f)
{
this.interpolateMovement = 1f;
}
}