public void Init(StringBuilder hudLabelText, MyModelsEnum? modelLod0Enum, MyModelsEnum? modelLod1Enum, Matrix localMatrix, MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum ammoType, MyLargeShipGunBase parentObject) { base.Init(hudLabelText, modelLod0Enum, modelLod1Enum, parentObject, null, null); LocalMatrix = localMatrix; ((MyLargeShipGunBase)parentObject).InitializationBarrelMatrix = LocalMatrix; // Check for the dummy cubes for the muzzle flash positions: if (ModelLod0 != null) { // test for one value: StringBuilder sb = new StringBuilder(); sb.Append(MyLargeShipWeaponsConstants.MUZZLE_FLASH_NAME_ONE); if (ModelLod0.Dummies.Count > 0) { if (ModelLod0.Dummies.ContainsKey(sb.ToString())) { // one muzzle flash value: m_muzzleDummies.Add(ModelLod0.Dummies[sb.ToString()]); } else { // more muzzle flashes values: int num = 0; for (int i = 0; i < ModelLod0.Dummies.Count; ++i) { sb.Clear(); sb.Append(MyLargeShipWeaponsConstants.MUZZLE_FLASH_NAME_MODE); sb.Append(i.ToString()); if (ModelLod0.Dummies.ContainsKey(sb.ToString())) { ++num; } } for (int i = 0; i < ModelLod0.Dummies.Count; ++i) { sb.Clear(); sb.Append(MyLargeShipWeaponsConstants.MUZZLE_FLASH_NAME_MODE); sb.Append(i.ToString()); if (ModelLod0.Dummies.ContainsKey(sb.ToString())) { m_muzzleDummies.Add(ModelLod0.Dummies[sb.ToString()]); } } } } } //base.InitSpherePhysics(MyMaterialType.METAL, ModelLod0, 9999999.0f, 1.0f, MyConstants.COLLISION_LAYER_ALL, RigidBodyFlag.RBF_RBO_STATIC); if (this.Physics != null) { //this.Physics.Enabled = true; this.Physics.Update(); } m_ammoType = ammoType; Save = false; //NeedsUpdate = true; //No, barrel is updated from parent }
public void Init(StringBuilder hudLabelText, Matrix localMatrix, MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum AmmoType, MyLargeShipGunBase parentObject) { base.Init(hudLabelText, MyModelsEnum.LargeShipMachineGunBarrel, null, localMatrix, AmmoType, parentObject); // Muzzle flash position from the dummy on the model: Matrix muzzleFlashDummy = ModelLod0 != null ? ModelLod0.Dummies["MUZZLE_FLASH"].Matrix : Matrix.Identity; m_muzzleFlashStartPosition = muzzleFlashDummy.Translation; }
public void Init(StringBuilder hudLabelText, MyModelsEnum modelEnum, int burstFireCount, Matrix localMatrix, MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum ammoType, MyLargeShipGunBase parentObject) { base.Init(hudLabelText, modelEnum, null, localMatrix, ammoType, parentObject); m_burstFireCount = burstFireCount; m_burstToFire = m_burstFireCount; m_burstFireTime_ms = MyMinerGame.TotalGamePlayTimeInMilliseconds; // User settings: m_burstFireTimeLoadingIntervalConst_ms = 2000; // This is imoprtant for missile launchers (they are not able to lauchching rackets on safe trajectory) //BarrelElevationMin = 0.1571f; BarrelElevationMin = -0.6f; }
public void Init(StringBuilder hudLabelText, Matrix localMatrix, MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum AmmoType, MyLargeShipGunBase parentObject) { base.Init(hudLabelText, MyModelsEnum.LargeShipAutocannonBarrel, null, localMatrix, AmmoType, parentObject); }
public static void CreateAloneWeapon(ref MyLargeShipGunBase weapon, string hudLabelText, Vector3 position, Matrix localOrientation, MyMwcObjectBuilder_PrefabLargeWeapon objectBuilder, bool activated) { StringBuilder sb = new StringBuilder("Large weapon"); MyMwcObjectBuilder_PrefabLargeWeapon_TypesEnum tmp = (MyMwcObjectBuilder_PrefabLargeWeapon_TypesEnum)objectBuilder.GetObjectBuilderId().Value; switch (tmp) { case MyMwcObjectBuilder_PrefabLargeWeapon_TypesEnum.P352_A01_LARGESHIP_MACHINEGUN: weapon = new MyLargeShipMachineGun(); break; case MyMwcObjectBuilder_PrefabLargeWeapon_TypesEnum.P352_A01_LARGESHIP_CIWS: weapon = new MyLargeShipCIWS(); break; case MyMwcObjectBuilder_PrefabLargeWeapon_TypesEnum.P352_A01_LARGESHIP_AUTOCANNON: weapon = new MyLargeShipAutocannon(); break; case MyMwcObjectBuilder_PrefabLargeWeapon_TypesEnum.P352_A01_LARGESHIP_MISSILE_BASIC4: case MyMwcObjectBuilder_PrefabLargeWeapon_TypesEnum.P352_A01_LARGESHIP_MISSILE_BASIC6: case MyMwcObjectBuilder_PrefabLargeWeapon_TypesEnum.P352_A01_LARGESHIP_MISSILE_BASIC9: case MyMwcObjectBuilder_PrefabLargeWeapon_TypesEnum.P352_A02_LARGESHIP_MISSILE_GUIDED4: case MyMwcObjectBuilder_PrefabLargeWeapon_TypesEnum.P352_A02_LARGESHIP_MISSILE_GUIDED6: case MyMwcObjectBuilder_PrefabLargeWeapon_TypesEnum.P352_A02_LARGESHIP_MISSILE_GUIDED9: weapon = new MyLargeShipMissileLauncherGun(); break; default: throw new MyMwcExceptionApplicationShouldNotGetHere(); break; } weapon.Init(null, null, position, localOrientation.Forward, localOrientation.Up, objectBuilder); Matrix world = Matrix.CreateWorld(position, localOrientation.Forward, localOrientation.Up); weapon.WorldMatrix = world; if (activated) { weapon.PersistentFlags &= ~MyPersistentEntityFlags.Deactivated; weapon.GetBarell().PersistentFlags &= ~MyPersistentEntityFlags.Deactivated; } else { weapon.PersistentFlags |= MyPersistentEntityFlags.Deactivated; weapon.GetBarell().PersistentFlags |= MyPersistentEntityFlags.Deactivated; } }