public int GetLength() { var mainCam1Len = MainCamera1 == null ? 0 : MainCamera1.GetLength(); var mainCam2Len = MainCamera2 == null ? 0 : MainCamera2.GetLength(); return(CamTrigger.GetLength() + 115 + mainCam1Len + mainCam2Len); }
public void Read(BinaryReader reader, int length) { CamTrigger.Header1 = reader.ReadUInt32(); CamTrigger.Enabled = reader.ReadUInt32(); CamTrigger.HeaderT = reader.ReadSingle(); CamTrigger.Rotation.Read(reader, Constants.SIZE_VECTOR4); CamTrigger.Position.Read(reader, Constants.SIZE_VECTOR4); CamTrigger.Scale.Read(reader, Constants.SIZE_VECTOR4); reader.ReadUInt32(); UInt32 instances_cnt = reader.ReadUInt32(); CamTrigger.HeaderH = reader.ReadUInt32(); CamTrigger.Instances.Clear(); for (int i = 0; i < instances_cnt; ++i) { CamTrigger.Instances.Add(reader.ReadUInt16()); } // Camera CameraHeader = reader.ReadUInt32(); UnkShort = reader.ReadUInt16(); UnkFloat1 = reader.ReadSingle(); UnkVector1.Read(reader, Constants.SIZE_VECTOR4); UnkVector2.Read(reader, Constants.SIZE_VECTOR4); UnkFloat2 = reader.ReadSingle(); UnkFloat3 = reader.ReadSingle(); UnkInt1 = reader.ReadUInt32(); UnkInt2 = reader.ReadUInt32(); UnkInt3 = reader.ReadUInt32(); UnkInt4 = reader.ReadUInt32(); UnkInt5 = reader.ReadUInt32(); UnkInt6 = reader.ReadUInt32(); UnkFloat4 = reader.ReadSingle(); UnkFloat5 = reader.ReadSingle(); UnkFloat6 = reader.ReadSingle(); UnkFloat7 = reader.ReadSingle(); UnkInt7 = reader.ReadUInt32(); UnkInt8 = reader.ReadUInt32(); UnkInt9 = reader.ReadUInt32(); UnkFloat8 = reader.ReadSingle(); TypeIndex1 = reader.ReadUInt32(); TypeIndex2 = reader.ReadUInt32(); UnkByte = reader.ReadByte(); if (TypeIndex1 != 3 && subCamIdToCamera.ContainsKey(TypeIndex1)) { MainCamera1 = (CameraSubBase)Activator.CreateInstance(subCamIdToCamera[TypeIndex1]); MainCamera1.Read(reader, MainCamera1.GetLength()); } if (TypeIndex2 != 3 && subCamIdToCamera.ContainsKey(TypeIndex2)) { MainCamera2 = (CameraSubBase)Activator.CreateInstance(subCamIdToCamera[TypeIndex2]); MainCamera2.Read(reader, MainCamera2.GetLength()); } }