public override void Unpack(BinaryReader reader) { Id = reader.ReadUInt32(); Bitfield = reader.ReadUInt32(); AllowFreeHeading = (Bitfield & 4) != 0; HasPhysicsBSP = (Bitfield & 8) != 0; // Get all the GraphicsObjects in this SetupModel. These are all the 01-types. uint numParts = reader.ReadUInt32(); for (int i = 0; i < numParts; i++) { Parts.Add(reader.ReadUInt32()); } if ((Bitfield & 1) != 0) { for (int i = 0; i < numParts; i++) { ParentIndex.Add(reader.ReadUInt32()); } } if ((Bitfield & 2) != 0) { for (int i = 0; i < numParts; i++) { DefaultScale.Add(reader.ReadVector3()); } } HoldingLocations.Unpack(reader); ConnectionPoints.Unpack(reader); int placementsCount = reader.ReadInt32(); for (int i = 0; i < placementsCount; i++) { int key = reader.ReadInt32(); // there is a frame for each Part var placementType = new PlacementType(); placementType.Unpack(reader, (uint)Parts.Count); PlacementFrames.Add(key, placementType); } CylSpheres.Unpack(reader); Spheres.Unpack(reader); Height = reader.ReadSingle(); Radius = reader.ReadSingle(); StepDownHeight = reader.ReadSingle(); StepUpHeight = reader.ReadSingle(); SortingSphere.Unpack(reader); SelectionSphere.Unpack(reader); Lights.Unpack(reader); DefaultAnimation = reader.ReadUInt32(); DefaultScript = reader.ReadUInt32(); DefaultMotionTable = reader.ReadUInt32(); DefaultSoundTable = reader.ReadUInt32(); DefaultScriptTable = reader.ReadUInt32(); }
void Awake() { ShipComponents = new List<ShipComponent>(); Weapons = new List<Weapon>(); TurretController = this.GetComponent<TurretController>(); CameraLocations = new List<GameObject>(); CameraLocations.Add(this.transform.FindChild("CameraCockpitLocation").gameObject); CameraLocations.Add(this.transform.FindChild("CameraFollowLocation").gameObject); _cameraCockpitLocation = this.transform.FindChild("CameraCockpitLocation").gameObject; _cameraFollowLocation = this.transform.FindChild("CameraFollowLocation").gameObject; _flarePosition = this.transform.FindChild("FlarePosition"); _selectionSphere = this.transform.GetComponentInChildren<SelectionSphere>(); _selectionSphere.GetSquadron += GetSquadron; }