bool ObjectIsSameWithInprecision(object one, object two)
{
if (one == null || two == null)
{
return one == null && two == null;
}
if (!one.Equals(two))
{
// if A is not B, lets check if A is almost B
if (one is Vector3)
{
Vector3 a = (Vector3)one;
Vector3 b = (Vector3)two;
if (a.AlmostEquals(b, PhotonNetwork.precisionForVectorSynchronization))
{
return true;
}
}
else if (one is Vector2)
{
Vector2 a = (Vector2)one;
Vector2 b = (Vector2)two;
if (a.AlmostEquals(b, PhotonNetwork.precisionForVectorSynchronization))
{
return true;
}
}
else if (one is Quaternion)
{
Quaternion a = (Quaternion)one;
Quaternion b = (Quaternion)two;
if (a.AlmostEquals(b, PhotonNetwork.precisionForQuaternionSynchronization))
{
return true;
}
}
else if (one is float)
{
float a = (float)one;
float b = (float)two;
if (a.AlmostEquals(b, PhotonNetwork.precisionForFloatSynchronization))
{
return true;
}
}
// one does not equal two
return false;
}
return true;
}