public ValueArray(ObjectReader reader) { var version = reader.version; if (version[0] < 5 || (version[0] == 5 && version[1] < 5)) //5.5 down { m_BoolValues = reader.ReadBooleanArray(); reader.AlignStream(); m_IntValues = reader.ReadInt32Array(); m_FloatValues = reader.ReadSingleArray(); } if (version[0] < 4 || (version[0] == 4 && version[1] < 3)) //4.3 down { m_VectorValues = reader.ReadVector4Array(); } else { int numPosValues = reader.ReadInt32(); m_PositionValues = new Vector3[numPosValues]; for (int i = 0; i < numPosValues; i++) { m_PositionValues[i] = version[0] > 5 || (version[0] == 5 && version[1] >= 4) ? reader.ReadVector3() : (Vector3)reader.ReadVector4(); //5.4 and up } m_QuaternionValues = reader.ReadVector4Array(); int numScaleValues = reader.ReadInt32(); m_ScaleValues = new Vector3[numScaleValues]; for (int i = 0; i < numScaleValues; i++) { m_ScaleValues[i] = version[0] > 5 || (version[0] == 5 && version[1] >= 4) ? reader.ReadVector3() : (Vector3)reader.ReadVector4(); //5.4 and up } if (version[0] > 5 || (version[0] == 5 && version[1] >= 5)) //5.5 and up { m_FloatValues = reader.ReadSingleArray(); m_IntValues = reader.ReadInt32Array(); m_BoolValues = reader.ReadBooleanArray(); reader.AlignStream(); } } }
public ValueArray(ObjectReader reader) { var version = reader.version; if (version[0] < 5 || (version[0] == 5 && version[1] < 5)) //5.5 down { int numBools = reader.ReadInt32(); m_BoolValues = new bool[numBools]; for (int i = 0; i < numBools; i++) { m_BoolValues[i] = reader.ReadBoolean(); } reader.AlignStream(4); m_IntValues = reader.ReadInt32Array(reader.ReadInt32()); m_FloatValues = reader.ReadSingleArray(reader.ReadInt32()); } int numPosValues = reader.ReadInt32(); m_PositionValues = new object[numPosValues]; for (int i = 0; i < numPosValues; i++) { m_PositionValues[i] = version[0] > 5 || (version[0] == 5 && version[1] >= 4) ? (object)reader.ReadVector3() : (object)reader.ReadVector4(); //5.4 and up } m_QuaternionValues = reader.ReadVector4Array(reader.ReadInt32()); int numScaleValues = reader.ReadInt32(); m_ScaleValues = new object[numScaleValues]; for (int i = 0; i < numScaleValues; i++) { m_ScaleValues[i] = version[0] > 5 || (version[0] == 5 && version[1] >= 4) ? (object)reader.ReadVector3() : (object)reader.ReadVector4(); //5.4 adn up } if (version[0] > 5 || (version[0] == 5 && version[1] >= 5)) //5.5 and up { m_FloatValues = reader.ReadSingleArray(reader.ReadInt32()); m_IntValues = reader.ReadInt32Array(reader.ReadInt32()); int numBools = reader.ReadInt32(); m_BoolValues = new bool[numBools]; for (int i = 0; i < numBools; i++) { m_BoolValues[i] = reader.ReadBoolean(); } reader.AlignStream(4); } }