Ejemplo n.º 1
0
        public virtual void Init(MyModelsEnum modelEnum, MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum ammoEnum, bool spherePhysics = true)
        {
            base.Init(null, modelEnum, null, null, null, null);

            AmmoType = ammoEnum;
            m_gameplayProperties = MyGameplayConstants.GetGameplayProperties(MyMwcObjectBuilderTypeEnum.SmallShip_Ammo, (int)ammoEnum, Faction);
            m_ammoProperties = MyAmmoConstants.GetAmmoProperties(ammoEnum);

            //  Collision skin
            if (spherePhysics)
            {
                InitSpherePhysics(MyMaterialType.AMMO, ModelLod0, m_gameplayProperties.WeightPerUnit,
                                  MyPhysicsConfig.DefaultAngularDamping, MyConstants.COLLISION_LAYER_DEFAULT,
                                  RigidBodyFlag.RBF_DEFAULT);
            }
            else
            {
                InitBoxPhysics(MyMaterialType.AMMO, ModelLod0, m_gameplayProperties.WeightPerUnit,
                               MyPhysicsConfig.DefaultAngularDamping, MyConstants.COLLISION_LAYER_DEFAULT,
                               RigidBodyFlag.RBF_DEFAULT);
            }

            Physics.GetRBElementList()[0].Flags |= MyElementFlag.EF_MODEL_PREFER_LOD0;

            NeedsUpdate = true;
            RenderObjects[0].SkipIfTooSmall = false;
            CastShadows = false;
            Closed = true; //Because ammobase instance is going to pool. It is started by Start()

            IsDestructible = true;

            PreloadTextures();
        }
Ejemplo n.º 2
0
        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
        }
Ejemplo n.º 3
0
        public virtual void Init(MyModelsEnum modelEnum, MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum ammoEnum, bool spherePhysics = true)
        {
            base.Init(null, modelEnum, null, null, null, null);

            AmmoType             = ammoEnum;
            m_gameplayProperties = MyGameplayConstants.GetGameplayProperties(MyMwcObjectBuilderTypeEnum.SmallShip_Ammo, (int)ammoEnum, Faction);
            m_ammoProperties     = MyAmmoConstants.GetAmmoProperties(ammoEnum);

            //  Collision skin
            if (spherePhysics)
            {
                InitSpherePhysics(MyMaterialType.AMMO, ModelLod0, m_gameplayProperties.WeightPerUnit,
                                  MyPhysicsConfig.DefaultAngularDamping, MyConstants.COLLISION_LAYER_DEFAULT,
                                  RigidBodyFlag.RBF_DEFAULT);
            }
            else
            {
                InitBoxPhysics(MyMaterialType.AMMO, ModelLod0, m_gameplayProperties.WeightPerUnit,
                               MyPhysicsConfig.DefaultAngularDamping, MyConstants.COLLISION_LAYER_DEFAULT,
                               RigidBodyFlag.RBF_DEFAULT);
            }

            Physics.GetRBElementList()[0].Flags |= MyElementFlag.EF_MODEL_PREFER_LOD0;

            NeedsUpdate = true;
            RenderObjects[0].SkipIfTooSmall = false;
            CastShadows = false;
            Closed      = true; //Because ammobase instance is going to pool. It is started by Start()

            IsDestructible = true;

            PreloadTextures();
        }
 public MyMwcObjectBuilder_AssignmentOfAmmo(MyMwcObjectBuilder_FireKeyEnum fireKey, 
     MyMwcObjectBuilder_AmmoGroupEnum group, MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum ammoType)
 {
     FireKey = fireKey;
     Group = group;
     AmmoType = ammoType;
 }
 public MyMwcObjectBuilder_AssignmentOfAmmo(MyMwcObjectBuilder_FireKeyEnum fireKey,
                                            MyMwcObjectBuilder_AmmoGroupEnum group, MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum ammoType)
 {
     FireKey  = fireKey;
     Group    = group;
     AmmoType = ammoType;
 }
Ejemplo n.º 6
0
        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
        }
Ejemplo n.º 7
0
        protected float m_muzzleFlashRadius;        // Radius of the muzzle flash

        #endregion

        public MyLargeShipBarrelBase()
        {            
            m_ammoType = 0;
            m_lastTimeShoot = 0;
            m_lastTimeSmooke = 0;
            //BarrelElevationMin = -0.507997036f;
            BarrelElevationMin = -0.6f;
        }
Ejemplo n.º 8
0
        protected float m_muzzleFlashRadius;       // Radius of the muzzle flash

        #endregion

        public MyLargeShipBarrelBase()
        {
            m_ammoType       = 0;
            m_lastTimeShoot  = 0;
            m_lastTimeSmooke = 0;
            //BarrelElevationMin = -0.507997036f;
            BarrelElevationMin = -0.6f;
        }
 private static void BindAmmo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum ammo, MyMwcObjectBuilder_AmmoGroupEnum group, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum weapon)
 {
     if (!m_ammoBinding.ContainsKey((int)ammo))
     {
         m_ammoBinding[(int)ammo] = new Dictionary <int, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum>();
     }
     m_ammoBinding[(int)ammo][(int)group] = weapon;
 }
Ejemplo n.º 10
0
        private void LoadAmmoFromShip()
        {
            m_selectedAmmo  = 0;
            m_selectedIndex = 0;
            m_ammoTypesAmounts.Clear();

            //If there is no ammo or no weapon, do nothing
            if (MySession.PlayerShip.Weapons.AmmoInventoryItems.GetAmmoInventoryItems().Count == 0 ||
                MySession.PlayerShip.Weapons.GetWeaponsObjectBuilders(false) == null)
            {
                return;
            }

            foreach (var ammoInventoryItem in MySession.PlayerShip.Weapons.AmmoInventoryItems.GetAmmoInventoryItems())
            {
                MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum ammoType = (MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum)ammoInventoryItem.ObjectBuilderId.Value;
                if (MyGuiSmallShipHelpers.IsAmmoInGroup(ammoType, m_selectedGroup))
                {
                    int index = -1;
                    for (int i = 0; i < m_ammoTypesAmounts.Count; i++)
                    {
                        if (m_ammoTypesAmounts[i].Type == ammoType)
                        {
                            index = i;
                            break;
                        }
                    }

                    if (index >= 0)
                    {
                        m_ammoTypesAmounts[index] = new MyAmmoItem(ammoType, m_ammoTypesAmounts[index].Amount + (int)ammoInventoryItem.Amount);
                    }
                    else
                    {
                        bool isWeapon = false;
                        foreach (var weaponBuilder in MySession.PlayerShip.Weapons.GetWeaponsObjectBuilders(false))
                        {
                            if (MyGuiSmallShipHelpers.GetWeaponType(ammoType, m_selectedGroup).HasValue&&
                                MyGuiSmallShipHelpers.GetWeaponType(ammoType, m_selectedGroup).Value == weaponBuilder.WeaponType)
                            {
                                isWeapon = true;
                                break;
                            }
                        }
                        if (isWeapon)
                        {
                            m_ammoTypesAmounts.Add(new MyAmmoItem(ammoType, (int)ammoInventoryItem.Amount));
                        }
                    }
                }
            }

            if (m_ammoTypesAmounts.Count > 0)
            {
                m_selectedAmmo = m_ammoTypesAmounts[m_selectedIndex].Type;
            }
        }
Ejemplo n.º 11
0
        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;
        }
Ejemplo n.º 12
0
 //  Add new missile to the list
 public static MyMissile Add(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum type, Vector3 position, Vector3 initialVelocity, Vector3 direction, Vector3 relativePos, MyEntity ignoreMinerShip, MyEntity target, float customMaxDistance = 0, bool isDummy = false, bool isLightWeight = false)
 {
     MyMissile newMissile = m_missiles.Allocate();
     if (newMissile != null)
     {
         newMissile.Start(type, position, initialVelocity, direction, relativePos, ignoreMinerShip, target, customMaxDistance, isDummy, isLightWeight);
     }
     return newMissile;
 }
        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;
        }
Ejemplo n.º 14
0
        //  Add new missile to the list
        public static MyMissile Add(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum type, Vector3 position, Vector3 initialVelocity, Vector3 direction, Vector3 relativePos, MyEntity ignoreMinerShip, MyEntity target, float customMaxDistance = 0, bool isDummy = false, bool isLightWeight = false)
        {
            MyMissile newMissile = m_missiles.Allocate();

            if (newMissile != null)
            {
                newMissile.Start(type, position, initialVelocity, direction, relativePos, ignoreMinerShip, target, customMaxDistance, isDummy, isLightWeight);
            }
            return(newMissile);
        }
Ejemplo n.º 15
0
        /// <summary>
        /// Returns ammo special text by fire key
        /// </summary>
        /// <param name="key">Fire key</param>
        /// <returns></returns>
        public StringBuilder GetAmmoSpecialText(MyMwcObjectBuilder_FireKeyEnum key)
        {
            //Get ammo type
            MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum ammoType = GetAmmoType(key);

            if (ammoType == 0)
            {
                return(null);
            }

            return(GetAmmoSpecialText(ammoType));
        }
        public static MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum?GetWeaponType(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum ammo, MyMwcObjectBuilder_AmmoGroupEnum group)
        {
            MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum ret;
            Dictionary <int, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum> dic;

            if (m_ammoBinding.TryGetValue((int)ammo, out dic))
            {
                if (dic.TryGetValue((int)group, out ret))
                {
                    return(ret);
                }
            }
            return(null);
        }
        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 Shoot(MyEntity entity, Matrix shooterMatrix, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum weapon, MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum ammo, MyEntity target, MyEntityIdentifier? projectileId)
        {
            if (!IsControlledByMe(entity))
            {
                return;
            }

            MyEventShoot msg = new MyEventShoot();
            msg.Position = new MyMwcPositionAndOrientation(shooterMatrix);
            msg.ShooterEntityId = entity.EntityId.Value.NumericValue;
            msg.ProjectileEntityId = MyEntityIdentifier.ToNullableInt(projectileId);
            msg.Ammo = ammo;
            msg.TargetEntityId = (target != null && target.EntityId.HasValue) ? target.EntityId.Value.NumericValue : (uint?)null;
            msg.Weapon = weapon;

            Peers.SendToAll(ref msg, NetDeliveryMethod.ReliableUnordered);
        }
Ejemplo n.º 19
0
        //  Read this object from message-in
        internal override bool Read(BinaryReader binaryReader, EndPoint senderEndPoint, int gameVersion)
        {
            if (base.Read(binaryReader, senderEndPoint, gameVersion) == false)
            {
                return(NetworkError());
            }

            //  Ammo Type
            MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum?ammoType = MyMwcMessageIn.ReadObjectBuilderSmallShipAmmoTypesEnumEx(binaryReader, senderEndPoint);

            if (ammoType == null)
            {
                return(NetworkError());
            }
            AmmoType = ammoType.Value;
            MyMwcLog.IfNetVerbose_AddToLog("AmmoType: " + AmmoType);

            return(true);
        }
Ejemplo n.º 20
0
        private static MyDroneFunction GetFunctionFromAmmoType(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum ammoBuilderType)
        {
            switch (ammoBuilderType)
            {
            case MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Universal_Launcher_Sphere_Explosive:
            case MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Universal_Launcher_Directional_Explosive:
            case MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Universal_Launcher_Flash_Bomb:
            case MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Universal_Launcher_Gravity_Bomb:
            case MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Universal_Launcher_Remote_Bomb:
            case MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Universal_Launcher_Decoy_Flare:
            case MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Universal_Launcher_EMP_Bomb:
                return(MyDroneFunction.Explosive);

            case MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Universal_Launcher_Smoke_Bomb:
            case MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Universal_Launcher_Hologram:
                return(MyDroneFunction.NonExplosive);

            default:
                return(MyDroneFunction.None);
            }
        }
        //  Read this object from message-in
        internal override bool Read(BinaryReader binaryReader, EndPoint senderEndPoint, int gameVersion)
        {
            if (base.Read(binaryReader, senderEndPoint, gameVersion) == false)
            {
                return(NetworkError());
            }

            //  FireKey
            MyMwcObjectBuilder_FireKeyEnum?fireKey = MyMwcMessageIn.ReadObjectBuilderSmallShipAssignmentOfAmmoFireKeyEnumEx(binaryReader, senderEndPoint);

            if (fireKey == null)
            {
                return(NetworkError());
            }
            FireKey = fireKey.Value;
            MyMwcLog.IfNetVerbose_AddToLog("FireKey: " + FireKey);

            //  FireKey
            MyMwcObjectBuilder_AmmoGroupEnum?group = MyMwcMessageIn.ReadObjectBuilderSmallShipAssignmentOfAmmoGroupEnumEx(binaryReader, senderEndPoint);

            if (group == null)
            {
                return(NetworkError());
            }
            Group = group.Value;
            MyMwcLog.IfNetVerbose_AddToLog("Group: " + Group);

            //  Ammo Type
            MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum?ammoType = MyMwcMessageIn.ReadObjectBuilderSmallShipAmmoTypesEnumEx(binaryReader, senderEndPoint);

            if (ammoType == null)
            {
                return(NetworkError());
            }
            AmmoType = ammoType.Value;
            MyMwcLog.IfNetVerbose_AddToLog("AmmoType: " + AmmoType);

            return(true);
        }
Ejemplo n.º 22
0
        /// <summary>
        /// Returns ammo special text from ammo type
        /// </summary>
        /// <param name="ammoType">Ammo type</param>
        /// <returns></returns>
        private StringBuilder GetAmmoSpecialText(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum ammoType)
        {
            switch (ammoType)
            {
            case MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Universal_Launcher_Time_Bomb:
                return(MyTimeBomb.GetAmmoSpecialText());

                break;

            case MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Universal_Launcher_Remote_Bomb:
                return(MyRemoteBomb.GetAmmoSpecialText());

                break;

            //case MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Universal_Launcher_Remote_Camera:
            //    return MyRemoteCamera.GetAmmoSpecialText();
            //    break;

            default:
                break;
            }

            return(MyMwcUtils.EmptyStringBuilder);
        }
Ejemplo n.º 23
0
        /// <summary>
        /// Returns amount of ammo which is bind at fire key
        /// </summary>
        /// <param name="key">Fire key</param>
        /// <returns></returns>
        public int GetAmountOfAmmo(MyMwcObjectBuilder_FireKeyEnum key)
        {
            if (AmmoInventoryItems.Count() == 0 || AmmoAssignments.Count() == 0)
            {
                return(0);
            }

            //Get ammo type
            MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum ammoType = AmmoAssignments.GetAmmoType(key);

            if (ammoType == 0)
            {
                return(0);
            }

            //Get amount
            int result = 0;

            foreach (MyInventoryItem ammoInventoryItem in AmmoInventoryItems.GetAmmoInventoryItems(ammoType))
            {
                result += (int)ammoInventoryItem.Amount;
            }
            return(result);
        }
 internal override void SetObjectBuilderIdInternal(int?objectBuilderId)
 {
     AmmoType = (MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum)Convert.ToUInt16(objectBuilderId);
 }
Ejemplo n.º 25
0
 public MyAmmoItem(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum type, int amount)
 {
     Amount = amount;
     Type   = type;
 }
Ejemplo n.º 26
0
        public override bool HandleInput(MyGuiInput input, bool hasKeyboardActiveControl, bool hasKeyboardActiveControlPrevious, bool receivedFocusInThisUpdate)
        {
            //If this control is not enable, do nothing
            if (!IsEnabled)
            {
                return(false);
            }

            bool isKeyPress = false;
            bool backwardSelectDirection = input.IsKeyPress(Keys.LeftShift) || input.IsKeyPress(Keys.RightShift);
            int  deltaWheelPos           = input.PreviousMouseScrollWheelValue() - input.MouseScrollWheelValue();

            if (deltaWheelPos != 0) // determine just direction
            {
                deltaWheelPos /= Math.Abs(deltaWheelPos);
            }

            if (input.IsNewGameControlPressed(MyGameControlEnums.SELECT_AMMO_BULLET))
            {
                isKeyPress      = true;
                m_selectedGroup = MyMwcObjectBuilder_AmmoGroupEnum.Bullet;
            }

            if (input.IsNewGameControlPressed(MyGameControlEnums.SELECT_AMMO_MISSILE))
            {
                isKeyPress      = true;
                m_selectedGroup = MyMwcObjectBuilder_AmmoGroupEnum.Missile;
            }

            if (input.IsNewGameControlPressed(MyGameControlEnums.SELECT_AMMO_CANNON))
            {
                isKeyPress      = true;
                m_selectedGroup = MyMwcObjectBuilder_AmmoGroupEnum.Cannon;
            }

            if (input.IsNewGameControlPressed(MyGameControlEnums.SELECT_AMMO_UNIVERSAL_LAUNCHER_FRONT))
            {
                isKeyPress      = true;
                m_selectedGroup = MyMwcObjectBuilder_AmmoGroupEnum.UniversalLauncherFront;
            }

            if (input.IsNewGameControlPressed(MyGameControlEnums.SELECT_AMMO_UNIVERSAL_LAUNCHER_BACK))
            {
                isKeyPress      = true;
                m_selectedGroup = MyMwcObjectBuilder_AmmoGroupEnum.UniversalLauncherBack;
            }

            // in case of wheel direction modify flags to run correct code
            if (deltaWheelPos > 0 && Visible && IsEnabled)
            {
                isKeyPress = true;
                backwardSelectDirection = false;
            }
            // in case of wheel direction modify flags to run correct code
            if (deltaWheelPos < 0 && Visible && IsEnabled)
            {
                isKeyPress = true;
                backwardSelectDirection = true;
            }

            if (isKeyPress)
            {
                if (Visible == false)
                {
                    //I am here when the menu opens
                    LoadAmmoFromShip();
                    //If player change fire commands during game play, we need to show actual buttons names.
                    //ReloadControlText();
                    MyGuiSmallShipHelperAmmo.ResetDescription();
                }
                else
                {
                    if (m_selectedGroup == m_selectedGroupLast)
                    {
                        // if (!MyFakes.MW25D)
                        {
                            if (!backwardSelectDirection)
                            {
                                m_selectedIndex++;
                            }
                            else
                            {
                                m_selectedIndex--;
                            }
                        }
                        // else
                        //   m_selectedIndex = 0;
                    }
                    else
                    {
                        //I am here when category is changed
                        LoadAmmoFromShip();
                        MyGuiSmallShipHelperAmmo.ResetDescription();
                    }

                    if (m_selectedIndex >= m_ammoTypesAmounts.Count)
                    {
                        m_selectedIndex = 0;
                    }
                    if (m_selectedIndex < 0)
                    {
                        m_selectedIndex = m_ammoTypesAmounts.Count - 1;
                    }
                }

                Visible             = true;
                m_selectedGroupLast = m_selectedGroup;
                if (m_selectedIndex < m_ammoTypesAmounts.Count && m_selectedIndex >= 0)
                {
                    m_selectedAmmo = m_ammoTypesAmounts[m_selectedIndex].Type;
                }

                MyAudio.AddCue2D(MySoundCuesEnum.SfxHudWeaponScroll);
            }


            //Because I do not want the gun fired before I made the choice, the menu disappears after the release of key (not press)
            if (Visible)
            {
                if (!MySession.Is25DSector)
                {
                    if (input.IsGameControlPressed(MyGameControlEnums.FIRE_PRIMARY) && m_selectedAmmo != 0)
                    {
                        MySession.PlayerShip.Weapons.AmmoAssignments.AssignAmmo(MyMwcObjectBuilder_FireKeyEnum.Primary, m_selectedGroup, m_selectedAmmo);
                        m_isPressLast = true;
                    }
                    if (input.IsGameControlPressed(MyGameControlEnums.FIRE_SECONDARY) && m_selectedAmmo != 0)
                    {
                        MySession.PlayerShip.Weapons.AmmoAssignments.AssignAmmo(MyMwcObjectBuilder_FireKeyEnum.Secondary, m_selectedGroup, m_selectedAmmo);
                        m_isPressLast = true;
                    }
                    if (input.IsGameControlPressed(MyGameControlEnums.FIRE_THIRD) && m_selectedAmmo != 0)
                    {
                        MySession.PlayerShip.Weapons.AmmoAssignments.AssignAmmo(MyMwcObjectBuilder_FireKeyEnum.Third, m_selectedGroup, m_selectedAmmo);
                        m_isPressLast = true;
                    }
                    if (input.IsGameControlPressed(MyGameControlEnums.FIRE_FOURTH) && m_selectedAmmo != 0)
                    {
                        MySession.PlayerShip.Weapons.AmmoAssignments.AssignAmmo(MyMwcObjectBuilder_FireKeyEnum.Fourth, m_selectedGroup, m_selectedAmmo);
                        m_isPressLast = true;
                    }
                    if (input.IsGameControlPressed(MyGameControlEnums.FIRE_FIFTH) && m_selectedAmmo != 0)
                    {
                        MySession.PlayerShip.Weapons.AmmoAssignments.AssignAmmo(MyMwcObjectBuilder_FireKeyEnum.Fifth, m_selectedGroup, m_selectedAmmo);
                        m_isPressLast = true;
                    }

                    if (input.IsNewKeyPress(Keys.Escape))
                    {
                        Visible = false;
                    }
                }
                else
                {  //MyFakes.MW25D
                    if (input.IsGameControlPressed(MyGameControlEnums.FIRE_PRIMARY) && m_selectedAmmo != 0)
                    {
                        MySession.PlayerShip.Weapons.AmmoAssignments.AssignAmmo(MyMwcObjectBuilder_FireKeyEnum.Primary, m_selectedGroup, m_selectedAmmo);
                        m_isPressLast = true;
                    }
                    if (input.IsGameControlPressed(MyGameControlEnums.FIRE_SECONDARY) && m_selectedAmmo != 0)
                    {
                        MySession.PlayerShip.Weapons.AmmoAssignments.AssignAmmo(MyMwcObjectBuilder_FireKeyEnum.Primary, m_selectedGroup, m_selectedAmmo);
                        m_isPressLast = true;
                    }
                    if (input.IsGameControlPressed(MyGameControlEnums.FIRE_THIRD) && m_selectedAmmo != 0)
                    {
                        MySession.PlayerShip.Weapons.AmmoAssignments.AssignAmmo(MyMwcObjectBuilder_FireKeyEnum.Primary, m_selectedGroup, m_selectedAmmo);
                        m_isPressLast = true;
                    }
                    if (input.IsGameControlPressed(MyGameControlEnums.FIRE_FOURTH) && m_selectedAmmo != 0)
                    {
                        MySession.PlayerShip.Weapons.AmmoAssignments.AssignAmmo(MyMwcObjectBuilder_FireKeyEnum.Primary, m_selectedGroup, m_selectedAmmo);
                        m_isPressLast = true;
                    }
                    if (input.IsGameControlPressed(MyGameControlEnums.FIRE_FIFTH) && m_selectedAmmo != 0)
                    {
                        MySession.PlayerShip.Weapons.AmmoAssignments.AssignAmmo(MyMwcObjectBuilder_FireKeyEnum.Primary, m_selectedGroup, m_selectedAmmo);
                        m_isPressLast = true;
                    }

                    if (input.IsNewKeyPress(Keys.Escape))
                    {
                        Visible = false;
                    }
                }

                for (int i = m_ammoTypesAmounts.Count - 1; i >= 0; i--)
                {
                    int itemsPerColumn = 7;

                    int orderX = (int)m_selectedGroup + i / itemsPerColumn;
                    int orderY = i % itemsPerColumn;

                    /*
                     * Vector2 mousePos = MyGuiManager.MouseCursorPosition;
                     * if (MyVideoModeManager.IsTripleHead() == true)
                     *  mousePos += new Vector2(-1, 0);
                     *
                     * if (MyGuiSmallShipHelpers.GetMyGuiSmallShipHelperAmmo(m_ammoTypesAmounts[i].Type).IsPointInMyArea(mousePos))
                     * {
                     * }
                     */
                    //if (MyGuiSmallShipHelpers.GetMyGuiSmallShipHelperAmmo(m_ammoTypesAmounts[i].Type).IsPointInMyArea(MyGuiManager.MouseCursorPosition))
                    MyGuiSmallShipHelperAmmo ammoHelper =
                        MyGuiObjectBuilderHelpers.GetGuiHelper(MyMwcObjectBuilderTypeEnum.SmallShip_Ammo, (int)m_ammoTypesAmounts[i].Type) as MyGuiSmallShipHelperAmmo;
                    if (ammoHelper.IsPointInMyArea(MyGuiManager.MouseCursorPosition))
                    {
                        if (m_selectedIndex != i || m_selectedAmmo != m_ammoTypesAmounts[m_selectedIndex].Type)
                        {
                            MyAudio.AddCue2D(MySoundCuesEnum.SfxHudWeaponScroll);
                        }
                        m_selectedIndex = i;
                        m_selectedAmmo  = m_ammoTypesAmounts[m_selectedIndex].Type;
                    }
                }

                //if (!MyFakes.MW25D)
                {
                    if (m_isPressLast &&
                        !input.IsGameControlPressed(MyGameControlEnums.FIRE_PRIMARY) &&
                        !input.IsGameControlPressed(MyGameControlEnums.FIRE_SECONDARY) &&
                        !input.IsGameControlPressed(MyGameControlEnums.FIRE_THIRD) &&
                        !input.IsGameControlPressed(MyGameControlEnums.FIRE_FOURTH) &&
                        !input.IsGameControlPressed(MyGameControlEnums.FIRE_FIFTH))
                    {
                        //I am here when the menu closes
                        m_isPressLast = false;
                        Visible       = false;
                        MyAudio.AddCue2D(MySoundCuesEnum.SfxHudWeaponSelect);
                    }
                }

                /*  else
                 * {
                 *    if (isKeyPress)
                 *        MyAudio.AddCue2D(MySoundCuesEnum.SfxHudWeaponSelect);
                 * } */
            }

            /*
             * if (MyFakes.MW25D)
             * {
             * return false;
             * }   */

            return(base.HandleInput(input, hasKeyboardActiveControl, hasKeyboardActiveControlPrevious, receivedFocusInThisUpdate));
        }
Ejemplo n.º 27
0
        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;
        }
Ejemplo n.º 28
0
        //  Every child of this base class must implement Shot() method, which shots projectile or missile.
        //  Method returns true if something was shot. False if not (because interval between two shots didn't pass)
        public override bool Shot(MyMwcObjectBuilder_SmallShip_Ammo usedAmmo)
        {
            if (GetParentMinerShip() == null)
            {
                return(false);
            }

            //  Allow shoting only at intervals
            if ((MyMinerGame.TotalGamePlayTimeInMilliseconds - m_lastTimeShoot) < MyAutocanonConstants.SHOT_INTERVAL_IN_MILISECONDS && !IsDummy)
            {
                return(false);
            }
            //  Stop 'release cue' if playing
            MySoundCue?autocanonReleaseCue = GetParentMinerShip().UnifiedWeaponCueGet(AUTOCANON_RELEASE);

            if ((autocanonReleaseCue != null) && (autocanonReleaseCue.Value.IsPlaying == true))
            {
                autocanonReleaseCue.Value.Stop(SharpDX.XACT3.StopFlags.Immediate);
            }

            //  Angle of muzzle flash particle
            m_muzzleFlashLength = MyMwcUtils.GetRandomFloat(3, 4) * m_barrel.GetMuzzleSize();
            m_muzzleFlashRadius = MyMwcUtils.GetRandomFloat(1.8f, 2.2f) * m_barrel.GetMuzzleSize();

            //  Increase count of smokes to draw
            SmokesToGenerateIncrease();

            //Use looping cue only in playership
            MySoundCuesEnum attackCue = GetParentMinerShip() == MySession.PlayerShip ? AUTOCANON_ATTACK_LOOP : AUTOCANON_ATTACK;

            //  Start 'attack and loop' cue (shooting)
            MySoundCue?autocanonAttackLoopCue = GetParentMinerShip().UnifiedWeaponCueGet(attackCue);

            if ((autocanonAttackLoopCue == null) || (autocanonAttackLoopCue.Value.IsPlaying == false))
            {
                //MyMwcLog.WriteLine("Adding new AUTOCANNON attack loop");
                GetParentMinerShip().UnifiedWeaponCueSet(
                    attackCue,
                    MyAudio.AddCue2dOr3d(GetParentMinerShip(), attackCue,
                                         m_positionMuzzleInWorldSpace, WorldMatrix.Forward, WorldMatrix.Up, Parent.Physics.LinearVelocity));
            }

            MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum ammoType = MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Autocannon_Basic;

            if (usedAmmo != null) //TODO: bot fires without ammo
            {
                ammoType = usedAmmo.AmmoType;
            }

            MyAmmoProperties ammoProperties = MyAmmoConstants.GetAmmoProperties(ammoType);

            MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartProfilingBlock("MyAutocannonGun.Shot add projectile");

            if (MyMwcFinalBuildConstants.ENABLE_TRAILER_SAVE)
            {
                MinerWars.AppCode.Game.Trailer.MyTrailerSave.UpdateGunShot(this.Parent, Trailer.MyTrailerGunsShotTypeEnum.PROJECTILE);
            }

            AddProjectile(ammoProperties, this);
            MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().EndProfilingBlock();

            m_cannonMotorEndPlayed = false;
            m_lastTimeShoot        = MyMinerGame.TotalGamePlayTimeInMilliseconds;

            //  We shot one projectile
            return(true);
        }
Ejemplo n.º 29
0
        /// <summary>
        /// Constants for all mountable weapons
        /// TODO: numeric params should be taken from editor later
        /// </summary>
        private MyBotParams SettingsForWeaponType(MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum weaponType, MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum ammoType)
        {
            var settings = new MyBotParams { WeaponsParams = new float[Enum.GetNames(typeof(MyBotWeaponsParametrsEnum)).Length] };

            switch (weaponType)
            {
                case MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Autocanon:
                    {
                        settings.WeaponsParams[(int)MyBotWeaponsParametrsEnum.FiringDurationTuner] = 10.0f;
                        settings.WeaponsParams[(int)MyBotWeaponsParametrsEnum.FiringFrequencyTuner] = 0.06f;
                        settings.WeaponsParams[(int)MyBotWeaponsParametrsEnum.FiringConeTuner] = 0.2f;
                        settings.WeaponsParams[(int)MyBotWeaponsParametrsEnum.ShotIntervalMilliseconds] = MyAutocanonConstants.SHOT_INTERVAL_IN_MILISECONDS;
                        settings.WeaponsParams[(int)MyBotWeaponsParametrsEnum.FiringDistanceTuner] = 0.9f;
                        settings.Enabled = true;
                        break;
                    }
                case MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Shotgun:
                    {
                        settings.WeaponsParams[(int)MyBotWeaponsParametrsEnum.FiringDurationTuner] = 0.5f;
                        settings.WeaponsParams[(int)MyBotWeaponsParametrsEnum.FiringFrequencyTuner] = 0.3f;
                        settings.WeaponsParams[(int)MyBotWeaponsParametrsEnum.FiringConeTuner] = 1.4f;
                        settings.WeaponsParams[(int)MyBotWeaponsParametrsEnum.ShotIntervalMilliseconds] = MyShotgunConstants.SHOT_INTERVAL_IN_MILISECONDS;
                        settings.WeaponsParams[(int)MyBotWeaponsParametrsEnum.FiringDistanceTuner] = 0.9f;
                        settings.Enabled = true;
                        break;
                    }
                case MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Automatic_Rifle_With_Silencer:
                    {
                        settings.WeaponsParams[(int)MyBotWeaponsParametrsEnum.FiringDurationTuner] = 0.3f;
                        settings.WeaponsParams[(int)MyBotWeaponsParametrsEnum.FiringFrequencyTuner] = 0.4f;
                        settings.WeaponsParams[(int)MyBotWeaponsParametrsEnum.FiringConeTuner] = 0.2f;
                        settings.WeaponsParams[(int)MyBotWeaponsParametrsEnum.ShotIntervalMilliseconds] = MyARSConstants.SHOT_INTERVAL_IN_MILISECONDS;
                        settings.WeaponsParams[(int)MyBotWeaponsParametrsEnum.FiringDistanceTuner] = 0.9f;
                        settings.Enabled = true;
                        break;
                    }
                case MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Cannon:
                    {
                        settings.WeaponsParams[(int)MyBotWeaponsParametrsEnum.FiringDurationTuner] = 0.15f;
                        settings.WeaponsParams[(int)MyBotWeaponsParametrsEnum.FiringFrequencyTuner] = 0.2f;
                        settings.WeaponsParams[(int)MyBotWeaponsParametrsEnum.FiringConeTuner] = 0.25f;
                        settings.WeaponsParams[(int)MyBotWeaponsParametrsEnum.ShotIntervalMilliseconds] = MyCannonConstants.SHOT_INTERVAL_IN_MILISECONDS;
                        settings.WeaponsParams[(int)MyBotWeaponsParametrsEnum.FiringDistanceTuner] = 0.9f;
                        settings.Enabled = true;
                        break;
                    }
                case MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Machine_Gun:
                    {
                        settings.WeaponsParams[(int)MyBotWeaponsParametrsEnum.FiringDurationTuner] = 0.6f;
                        settings.WeaponsParams[(int)MyBotWeaponsParametrsEnum.FiringFrequencyTuner] = 0.6f;
                        settings.WeaponsParams[(int)MyBotWeaponsParametrsEnum.FiringConeTuner] = 0.2f;
                        settings.WeaponsParams[(int)MyBotWeaponsParametrsEnum.ShotIntervalMilliseconds] = MyMachineGunConstants.SHOT_INTERVAL_IN_MILISECONDS;
                        settings.WeaponsParams[(int)MyBotWeaponsParametrsEnum.FiringDistanceTuner] = 0.9f;
                        settings.Enabled = true;
                        break;
                    }
                case MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Missile_Launcher:
                    {
                        settings.WeaponsParams[(int)MyBotWeaponsParametrsEnum.FiringDurationTuner] = 0.2f;
                        settings.WeaponsParams[(int)MyBotWeaponsParametrsEnum.FiringFrequencyTuner] = 0.25f;
                        settings.WeaponsParams[(int)MyBotWeaponsParametrsEnum.FiringConeTuner] = 0.45f;
                        settings.WeaponsParams[(int)MyBotWeaponsParametrsEnum.ShotIntervalMilliseconds] = MyMissileConstants.MISSILE_LAUNCHER_SHOT_INTERVAL_IN_MILISECONDS;
                        settings.WeaponsParams[(int)MyBotWeaponsParametrsEnum.FiringDistanceTuner] = 0.9f;
                        settings.Enabled = true;
                        break;
                    }
                case MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Sniper:
                    {
                        settings.WeaponsParams[(int)MyBotWeaponsParametrsEnum.FiringDurationTuner] = 0.2f;
                        settings.WeaponsParams[(int)MyBotWeaponsParametrsEnum.FiringFrequencyTuner] = 0.2f;
                        settings.WeaponsParams[(int)MyBotWeaponsParametrsEnum.FiringConeTuner] = 0.05f;
                        settings.WeaponsParams[(int)MyBotWeaponsParametrsEnum.ShotIntervalMilliseconds] = MySniperConstants.SHOT_INTERVAL_IN_MILISECONDS;
                        settings.WeaponsParams[(int)MyBotWeaponsParametrsEnum.FiringDistanceTuner] = 0.9f;
                        settings.Enabled = true;
                        break;
                    }
                case (MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Universal_Launcher_Back):
                    {
                        settings.WeaponsParams[(int)MyBotWeaponsParametrsEnum.FiringDurationTuner] = 0.15f;
                        settings.WeaponsParams[(int)MyBotWeaponsParametrsEnum.FiringFrequencyTuner] = 0.05f;
                        settings.WeaponsParams[(int)MyBotWeaponsParametrsEnum.FiringConeTuner] = 1.0f;
                        settings.WeaponsParams[(int)MyBotWeaponsParametrsEnum.ShotIntervalMilliseconds] = MyMissileConstants.MISSILE_LAUNCHER_SHOT_INTERVAL_IN_MILISECONDS;
                        settings.WeaponsParams[(int)MyBotWeaponsParametrsEnum.FiringDistanceTuner] = 0.9f;
                        settings.Enabled = false;
                        break;
                    }
                case MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Universal_Launcher_Front:
                    {
                        settings.WeaponsParams[(int)MyBotWeaponsParametrsEnum.FiringDurationTuner] = 0.15f;
                        settings.WeaponsParams[(int)MyBotWeaponsParametrsEnum.FiringFrequencyTuner] = 0.05f;
                        settings.WeaponsParams[(int)MyBotWeaponsParametrsEnum.FiringConeTuner] = 0.5f;
                        settings.WeaponsParams[(int)MyBotWeaponsParametrsEnum.ShotIntervalMilliseconds] = MyMissileConstants.MISSILE_LAUNCHER_SHOT_INTERVAL_IN_MILISECONDS;
                        settings.WeaponsParams[(int)MyBotWeaponsParametrsEnum.FiringDistanceTuner] = 0.9f;
                        settings.Enabled = true;
                        break;
                    }
            }

            //Keep max trajectory and weapon type
            settings.WeaponsParams[(int)MyBotWeaponsParametrsEnum.FiringDistance] = MyAmmoConstants.GetAmmoProperties(ammoType).MaxTrajectory;

            settings.WeaponType = weaponType;

            settings.LastShotMilliseconds = MyMinerGame.TotalGamePlayTimeInMilliseconds;
            return settings;
        }
Ejemplo n.º 30
0
 public static MyAmmoProperties GetAmmoProperties(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum ammoType)
 {
     return m_ammoProperties[(int)ammoType];
 }
Ejemplo n.º 31
0
        //  This method realy initiates/starts the missile
        //  IMPORTANT: Direction vector must be normalized!
        public virtual void Start(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum type, Vector3 position, Vector3 initialVelocity, Vector3 direction, Vector3 relativePos, MyEntity minerShip, MyEntity target, float customMaxDistance, bool isDummy, bool isLightWeight)
        {
            m_ammoProperties = MyAmmoConstants.GetAmmoProperties(type);
            m_missileType    = type;
            m_isExploded     = false;
            m_collidedEntity = null;
            m_collisionPoint = null;
            m_maxTrajectory  = customMaxDistance > 0 ? customMaxDistance : m_ammoProperties.MaxTrajectory;
            IsDummy          = isDummy;
            Faction          = minerShip.Faction;

            Vector3?correctedDirection = null;

            if (MyGameplayConstants.GameplayDifficultyProfile.EnableAimCorrection)
            {
                if (minerShip == MinerWars.AppCode.Game.Managers.Session.MySession.PlayerShip)
                {
                    correctedDirection = MyEntities.GetDirectionFromStartPointToHitPointOfNearestObject(minerShip, position, m_ammoProperties.MaxTrajectory);
                }
            }

            if (correctedDirection != null)
            {
                direction = correctedDirection.Value;
            }

            base.Start(position, initialVelocity, direction, 0, minerShip);

            if (correctedDirection != null) //override the base class behaviour, update the missile direction
            {
                Matrix ammoWorld = minerShip.WorldMatrix;
                ammoWorld.Translation = position;
                ammoWorld.Forward     = correctedDirection.Value;

                SetWorldMatrix(ammoWorld);
            }

            switch (m_missileType)
            {
            //just going forward (deprecated)
            case MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Missile_Basic:
                m_initTime        = MyMissileConstants.MISSILE_INIT_TIME;
                m_initDir         = MyMissileConstants.MISSILE_INIT_DIR;
                m_blendVelocities = MyMissileConstants.MISSILE_BLEND_VELOCITIES_IN_MILISECONDS;
                m_missileTimeout  = MyMissileConstants.MISSILE_TIMEOUT;
                m_explosionType   = MyExplosionTypeEnum.MISSILE_EXPLOSION;
                break;

            case MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Missile_BioChem:
                m_initTime        = MyMissileConstants.MISSILE_INIT_TIME;
                m_initDir         = MyMissileConstants.MISSILE_INIT_DIR;
                m_blendVelocities = MyMissileConstants.MISSILE_BLEND_VELOCITIES_IN_MILISECONDS;
                m_missileTimeout  = MyMissileConstants.MISSILE_TIMEOUT;
                m_explosionType   = MyExplosionTypeEnum.BIOCHEM_EXPLOSION;
                break;

            case MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Missile_EMP:
                m_initTime        = MyMissileConstants.MISSILE_INIT_TIME;
                m_initDir         = MyMissileConstants.MISSILE_INIT_DIR;
                m_blendVelocities = MyMissileConstants.MISSILE_BLEND_VELOCITIES_IN_MILISECONDS;
                m_missileTimeout  = MyMissileConstants.MISSILE_TIMEOUT;
                m_explosionType   = MyExplosionTypeEnum.EMP_EXPLOSION;
                break;

            //Missile is guided to the nearest enemy in the radius
            case MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Guided_Missile_Engine_Detection:

            //Missile is guided to the closest enemy in the visible spot
            case MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Guided_Missile_Visual_Detection:

            //Missile is guided to actual selected target by smallship radar
            case MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Guided_Missile_Radar_Detection:
                m_initDir.X         = 5.0f * MathHelper.Clamp(relativePos.X, -1, 1);
                m_blendVelocities   = MyGuidedMissileConstants.MISSILE_BLEND_VELOCITIES_IN_MILISECONDS;
                m_missileTimeout    = MyGuidedMissileConstants.MISSILE_TIMEOUT;
                m_turnSpeed         = MyGuidedMissileConstants.MISSILE_TURN_SPEED;
                m_explosionType     = MyExplosionTypeEnum.MISSILE_EXPLOSION;
                GuidedInMultiplayer = true;
                break;

            default:
                throw new NotImplementedException();
            }


            UpdateTarget(target);


            if (!isLightWeight)
            {
                //  Play missile thrust cue (looping)
                m_thrusterCue = MyAudio.AddCue3D(m_ammoProperties.ShotSound, GetPosition(), WorldMatrix.Forward, WorldMatrix.Up, m_initialVelocity);

                m_light = MyLights.AddLight();
                if (m_light != null)
                {
                    m_light.Start(MyLight.LightTypeEnum.PointLight, GetPosition(), MyMissileHelperUtil.GetMissileLightColor(), 1, MyMissileConstants.MISSILE_LIGHT_RANGE);
                }
            }

#if DEBUG_MISSILE
            m_trailDebug.Clear();
#endif

            if (m_missileType == MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Missile_Basic)
            {
                /*
                 * MyParticleEffect startEffect = MyParticlesManager.CreateParticleEffect((int)MyParticleEffectsIDEnum.Smoke_MissileStart);
                 * startEffect.WorldMatrix = WorldMatrix;
                 */
                m_smokeEffect             = MyParticlesManager.CreateParticleEffect((int)MyParticleEffectsIDEnum.Smoke_Missile);
                m_smokeEffect.WorldMatrix = WorldMatrix;
                m_smokeEffect.AutoDelete  = false;
            }
        }
Ejemplo n.º 32
0
        /// <summary>
        /// Returns Max trajectory for given ammo type
        /// TODO: Universal launcher ammo
        /// </summary>
        private float GetMaxTrajectoryForAmmoType(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum ammoType)
        {
            float maxTrajectory = MyAmmoConstants.GetAmmoProperties(ammoType).MaxTrajectory;

            return maxTrajectory;
        }
Ejemplo n.º 33
0
 public void Init(StringBuilder hudLabelText, Matrix localMatrix, MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum AmmoType, MyLargeShipGunBase parentObject)
 {
     base.Init(hudLabelText, MyModelsEnum.LargeShipCiwsBarrel, null, localMatrix, AmmoType, parentObject);
 }
Ejemplo n.º 34
0
        /// <summary>
        /// Returns ammo special text from ammo type
        /// </summary>
        /// <param name="ammoType">Ammo type</param>
        /// <returns></returns>
        private StringBuilder GetAmmoSpecialText(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum ammoType)
        {
            switch (ammoType)
            {
                case MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Universal_Launcher_Time_Bomb:
                    return MyTimeBomb.GetAmmoSpecialText();
                    break;

                case MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Universal_Launcher_Remote_Bomb:
                    return MyRemoteBomb.GetAmmoSpecialText();
                    break;

                //case MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Universal_Launcher_Remote_Camera:
                //    return MyRemoteCamera.GetAmmoSpecialText();
                //    break;

                default:
                    break;
            }

            return MyMwcUtils.EmptyStringBuilder;
        }
 internal override void SetObjectBuilderIdInternal(int? objectBuilderId)
 {
     AmmoType = (MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum)Convert.ToUInt16(objectBuilderId);
 }
        public static MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum?GetFirstWeaponType(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum ammo)
        {
            Dictionary <int, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum> dic;

            if (m_ammoBinding.TryGetValue((int)ammo, out dic))
            {
                foreach (var kv in dic)
                {
                    return(kv.Value);
                }
            }
            return(null);
        }
 public static bool IsAmmoInGroup(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum ammo, MyMwcObjectBuilder_AmmoGroupEnum group)
 {
     return(m_ammoBinding.ContainsKey((int)ammo) && m_ammoBinding[(int)ammo].ContainsKey((int)group));
 }
Ejemplo n.º 38
0
        /// <summary>
        /// Assign ammo group, ammo type to fire key
        /// </summary>
        /// <param name="fireKey">Fire key</param>
        /// <param name="ammoGroup">Ammo group</param>
        /// <param name="ammoType">Ammmo type</param>
        public void AssignAmmo(MyMwcObjectBuilder_FireKeyEnum fireKey, MyMwcObjectBuilder_AmmoGroupEnum ammoGroup, MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum ammoType)
        {
            MyAmmoAssignment ammoAssignment = GetAmmoAssignment(fireKey);

            if (ammoAssignment != null)
            {
                ammoAssignment.AmmoGroup = ammoGroup;
                ammoAssignment.AmmoType  = ammoType;
            }
            else
            {
                m_ammoAssignmentCollection.Add((int)fireKey, new MyAmmoAssignment(fireKey, ammoGroup, ammoType));
            }
        }
Ejemplo n.º 39
0
 public void WriteObjectBuilderSmallShipAmmoTypesEnum(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum val)
 {
     m_binaryWriter.Write((ushort)val);
 }
        public void ProjectileHit(MyEntity target, Vector3 position, Vector3 direction, MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum ammoType, MyEntity source)
        {
            if (target.EntityId.HasValue)
            {
                MyEventProjectileHit msg = new MyEventProjectileHit();
                msg.TargetEntityId = target.EntityId.Value.NumericValue;
                msg.Position = position;
                msg.Direction = direction;
                msg.AmmoType = ammoType;

                msg.SourceEntityId = source != null ? MyEntityIdentifier.ToNullableInt(source.EntityId) : null;
                Peers.SendToAll(ref msg, NetDeliveryMethod.ReliableUnordered);
            }

        }
Ejemplo n.º 41
0
 /// <summary>
 /// Returns ammo inventory items by ammo type
 /// </summary>
 /// <param name="ammoType">Ammo type</param>
 /// <returns></returns>
 public List<MyInventoryItem> GetAmmoInventoryItems(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum ammoType)
 {
     return m_ammoInventoryItemsByAmmoType[(int) ammoType];            
 }
Ejemplo n.º 42
0
 private static void BindAmmo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum ammo, MyMwcObjectBuilder_AmmoGroupEnum group, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum weapon)
 {
     if (!m_ammoBinding.ContainsKey((int)ammo)) 
         m_ammoBinding[(int)ammo] = new Dictionary<int, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum>();
     m_ammoBinding[(int)ammo][(int)group] = weapon;
 }        
Ejemplo n.º 43
0
 public void Init(StringBuilder hudLabelText, Matrix localMatrix, MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum AmmoType, MyLargeShipGunBase parentObject)
 {
     base.Init(hudLabelText, MyModelsEnum.LargeShipAutocannonBarrel, null, localMatrix, AmmoType, parentObject);
 }
        //  Read this object from message-in
        internal override bool Read(BinaryReader binaryReader, EndPoint senderEndPoint, int gameVersion)
        {
            if (base.Read(binaryReader, senderEndPoint, gameVersion) == false) return NetworkError();

            //  Ammo Type
            MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum? ammoType = MyMwcMessageIn.ReadObjectBuilderSmallShipAmmoTypesEnumEx(binaryReader, senderEndPoint);
            if (ammoType == null) return NetworkError();
            AmmoType = ammoType.Value;
            MyMwcLog.IfNetVerbose_AddToLog("AmmoType: " + AmmoType);

            return true;
        }
Ejemplo n.º 45
0
        public static bool IsAmmoInGroup(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum ammo, MyMwcObjectBuilder_AmmoGroupEnum group)
        {
            return (m_ammoBinding.ContainsKey((int)ammo) && m_ammoBinding[(int)ammo].ContainsKey((int)group));

        }
        //  Read this object from message-in
        internal override bool Read(BinaryReader binaryReader, EndPoint senderEndPoint, int gameVersion)
        {
            if (base.Read(binaryReader, senderEndPoint, gameVersion) == false) return NetworkError();

            //  FireKey
            MyMwcObjectBuilder_FireKeyEnum? fireKey = MyMwcMessageIn.ReadObjectBuilderSmallShipAssignmentOfAmmoFireKeyEnumEx(binaryReader, senderEndPoint);
            if (fireKey == null) return NetworkError();
            FireKey = fireKey.Value;
            MyMwcLog.IfNetVerbose_AddToLog("FireKey: " + FireKey);

            //  FireKey
            MyMwcObjectBuilder_AmmoGroupEnum? group = MyMwcMessageIn.ReadObjectBuilderSmallShipAssignmentOfAmmoGroupEnumEx(binaryReader, senderEndPoint);
            if (group == null) return NetworkError();
            Group = group.Value;
            MyMwcLog.IfNetVerbose_AddToLog("Group: " + Group);

            //  Ammo Type
            MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum? ammoType = MyMwcMessageIn.ReadObjectBuilderSmallShipAmmoTypesEnumEx(binaryReader, senderEndPoint);
            if (ammoType == null) return NetworkError();
            AmmoType = ammoType.Value;
            MyMwcLog.IfNetVerbose_AddToLog("AmmoType: " + AmmoType);

            return true;
        }
        public void ProjectileHit(MyEntity target, Vector3 position, Vector3 direction, MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum ammoType, MyEntity source)
        {
            if (target.EntityId.HasValue)
            {
                MyEventProjectileHit msg = new MyEventProjectileHit();
                msg.TargetEntityId = target.EntityId.Value.NumericValue;
                msg.Position       = position;
                msg.Direction      = direction;
                msg.AmmoType       = ammoType;

                msg.SourceEntityId = source != null?MyEntityIdentifier.ToNullableInt(source.EntityId) : null;

                Peers.SendToAll(ref msg, NetDeliveryMethod.ReliableUnordered);
            }
        }
Ejemplo n.º 48
0
        private bool TryAssignAmmo(MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum weaponType, MyMwcObjectBuilder_AmmoGroupEnum ammoGroup, MyMwcObjectBuilder_FireKeyEnum fireKey, MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum[] ammoPriorities)
        {
            for (int i = 0; i < ammoPriorities.Length; i++)
            {
                if (Weapons.AmmoInventoryItems.GetAmmoInventoryItems(ammoPriorities[i]).Count > 0)
                {
                    Weapons.AmmoAssignments.AssignAmmo(fireKey, ammoGroup, ammoPriorities[i]);

                    MyBotParams botParamsOneSlot = SettingsForWeaponType(weaponType, ammoPriorities[i]);
                    botParamsOneSlot.FireKey = fireKey;
                    botParamsOneSlot.HasAmmo = true;
                    m_botWeaponParamsAllSlots[(int)fireKey - 1] = botParamsOneSlot;
                    return true;
                }
            }
            return false;
        }
        public void Shoot(MyEntity entity, Matrix shooterMatrix, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum weapon, MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum ammo, MyEntity target, MyEntityIdentifier?projectileId)
        {
            if (!IsControlledByMe(entity))
            {
                return;
            }

            MyEventShoot msg = new MyEventShoot();

            msg.Position           = new MyMwcPositionAndOrientation(shooterMatrix);
            msg.ShooterEntityId    = entity.EntityId.Value.NumericValue;
            msg.ProjectileEntityId = MyEntityIdentifier.ToNullableInt(projectileId);
            msg.Ammo           = ammo;
            msg.TargetEntityId = (target != null && target.EntityId.HasValue) ? target.EntityId.Value.NumericValue : (uint?)null;
            msg.Weapon         = weapon;

            Peers.SendToAll(ref msg, NetDeliveryMethod.ReliableUnordered);
        }
 public MyMwcObjectBuilder_SmallShip_Ammo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum ammoType)
 {
     AmmoType = ammoType;
 }
Ejemplo n.º 51
0
 /// <summary>
 /// Returns ammo inventory items by ammo type
 /// </summary>
 /// <param name="ammoType">Ammo type</param>
 /// <returns></returns>
 public List <MyInventoryItem> GetAmmoInventoryItems(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum ammoType)
 {
     return(m_ammoInventoryItemsByAmmoType[(int)ammoType]);
 }
Ejemplo n.º 52
0
 /// <summary>
 /// Assign ammo group, ammo type to fire key
 /// </summary>
 /// <param name="fireKey">Fire key</param>
 /// <param name="ammoGroup">Ammo group</param>
 /// <param name="ammoType">Ammmo type</param>
 public void AssignAmmo(MyMwcObjectBuilder_FireKeyEnum fireKey, MyMwcObjectBuilder_AmmoGroupEnum ammoGroup, MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum ammoType)
 {
     MyAmmoAssignment ammoAssignment = GetAmmoAssignment(fireKey);
     if (ammoAssignment != null)
     {
         ammoAssignment.AmmoGroup = ammoGroup;
         ammoAssignment.AmmoType = ammoType;
     }
     else
     {
         m_ammoAssignmentCollection.Add((int)fireKey, new MyAmmoAssignment(fireKey, ammoGroup, ammoType));
     }
 }
Ejemplo n.º 53
0
        public bool ReadObjectBuilderSmallShipAmmoTypesEnum(ref MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum val)
        {
            ushort numericValue = 0;

            return(ReadUInt16(ref numericValue) && MyMwcUtils.GetEnumFromNumber <MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum, ushort>(numericValue, ref val));
        }
Ejemplo n.º 54
0
 public static MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum? GetWeaponType(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum ammo, MyMwcObjectBuilder_AmmoGroupEnum group)
 {
     MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum ret;
     Dictionary<int, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum> dic;
     if (m_ammoBinding.TryGetValue((int)ammo, out dic))
     {
         if (dic.TryGetValue((int)group, out ret))
         {
             return ret;
         }
     }
     return null;
 }
Ejemplo n.º 55
0
 public static MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum? GetFirstWeaponType(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum ammo)
 {
     Dictionary<int, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum> dic;
     if (m_ammoBinding.TryGetValue((int)ammo, out dic))
     {
         foreach (var kv in dic)
         {
             return kv.Value;
         }
     }
     return null;
 }
Ejemplo n.º 56
0
        //  This method realy initiates/starts the missile
        //  IMPORTANT: Direction vector must be normalized!
        public virtual void Start(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum type, Vector3 position, Vector3 initialVelocity, Vector3 direction, Vector3 relativePos, MyEntity minerShip, MyEntity target, float customMaxDistance, bool isDummy, bool isLightWeight)
        {
            m_ammoProperties = MyAmmoConstants.GetAmmoProperties(type);
            m_missileType = type;
            m_isExploded = false;
            m_collidedEntity = null;
            m_collisionPoint = null;
            m_maxTrajectory = customMaxDistance > 0 ? customMaxDistance : m_ammoProperties.MaxTrajectory;
            IsDummy = isDummy;
            Faction = minerShip.Faction;

            Vector3? correctedDirection = null;
            if (MyGameplayConstants.GameplayDifficultyProfile.EnableAimCorrection)
            {
                if (minerShip == MinerWars.AppCode.Game.Managers.Session.MySession.PlayerShip)
                {
                    correctedDirection = MyEntities.GetDirectionFromStartPointToHitPointOfNearestObject(minerShip, position, m_ammoProperties.MaxTrajectory);
                }
            }

            if (correctedDirection != null)
                direction = correctedDirection.Value;

            base.Start(position, initialVelocity, direction, 0, minerShip);

            if (correctedDirection != null) //override the base class behaviour, update the missile direction
            {
                Matrix ammoWorld = minerShip.WorldMatrix;
                ammoWorld.Translation = position;
                ammoWorld.Forward = correctedDirection.Value;

                SetWorldMatrix(ammoWorld);
            }

            switch (m_missileType)
            {
                //just going forward (deprecated)
                case MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Missile_Basic:
                    m_initTime = MyMissileConstants.MISSILE_INIT_TIME;
                    m_initDir = MyMissileConstants.MISSILE_INIT_DIR;
                    m_blendVelocities = MyMissileConstants.MISSILE_BLEND_VELOCITIES_IN_MILISECONDS;
                    m_missileTimeout = MyMissileConstants.MISSILE_TIMEOUT;
                    m_explosionType = MyExplosionTypeEnum.MISSILE_EXPLOSION;
                    break;
                case MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Missile_BioChem:
                    m_initTime = MyMissileConstants.MISSILE_INIT_TIME;
                    m_initDir = MyMissileConstants.MISSILE_INIT_DIR;
                    m_blendVelocities = MyMissileConstants.MISSILE_BLEND_VELOCITIES_IN_MILISECONDS;
                    m_missileTimeout = MyMissileConstants.MISSILE_TIMEOUT;
                    m_explosionType = MyExplosionTypeEnum.BIOCHEM_EXPLOSION;
                    break;
                case MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Missile_EMP:
                    m_initTime = MyMissileConstants.MISSILE_INIT_TIME;
                    m_initDir = MyMissileConstants.MISSILE_INIT_DIR;
                    m_blendVelocities = MyMissileConstants.MISSILE_BLEND_VELOCITIES_IN_MILISECONDS;
                    m_missileTimeout = MyMissileConstants.MISSILE_TIMEOUT;
                    m_explosionType = MyExplosionTypeEnum.EMP_EXPLOSION;
                    break;

                //Missile is guided to the nearest enemy in the radius
                case MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Guided_Missile_Engine_Detection:

                //Missile is guided to the closest enemy in the visible spot
                case MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Guided_Missile_Visual_Detection:

                //Missile is guided to actual selected target by smallship radar
                case MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Guided_Missile_Radar_Detection:
                    m_initDir.X = 5.0f * MathHelper.Clamp(relativePos.X, -1, 1);
                    m_blendVelocities = MyGuidedMissileConstants.MISSILE_BLEND_VELOCITIES_IN_MILISECONDS;
                    m_missileTimeout = MyGuidedMissileConstants.MISSILE_TIMEOUT;
                    m_turnSpeed = MyGuidedMissileConstants.MISSILE_TURN_SPEED;
                    m_explosionType = MyExplosionTypeEnum.MISSILE_EXPLOSION;
                    GuidedInMultiplayer = true;
                    break;
                default:
                    throw new NotImplementedException();
            }


            UpdateTarget(target);


            if (!isLightWeight)
            {
                //  Play missile thrust cue (looping)
                m_thrusterCue = MyAudio.AddCue3D(m_ammoProperties.ShotSound, GetPosition(), WorldMatrix.Forward, WorldMatrix.Up, m_initialVelocity);

                m_light = MyLights.AddLight();
                if (m_light != null)
                {
                    m_light.Start(MyLight.LightTypeEnum.PointLight, GetPosition(), MyMissileHelperUtil.GetMissileLightColor(), 1, MyMissileConstants.MISSILE_LIGHT_RANGE);
                }
            }

#if DEBUG_MISSILE
            m_trailDebug.Clear();
#endif

            if (m_missileType == MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Missile_Basic)
            {
                /*
                MyParticleEffect startEffect = MyParticlesManager.CreateParticleEffect((int)MyParticleEffectsIDEnum.Smoke_MissileStart);
                startEffect.WorldMatrix = WorldMatrix;
                 */
                m_smokeEffect = MyParticlesManager.CreateParticleEffect((int)MyParticleEffectsIDEnum.Smoke_Missile);
                m_smokeEffect.WorldMatrix = WorldMatrix;
                m_smokeEffect.AutoDelete = false;
            }
        }
Ejemplo n.º 57
0
 public static void GetMissileAmmoParams(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum AmmoType, ref int MissileShotInterval)
 {
     MissileShotInterval = MyMissileConstants.MISSILE_LAUNCHER_SHOT_INTERVAL_IN_MILISECONDS;
     switch (AmmoType)
     {
         case MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Missile_Basic:
             break;
         case MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Guided_Missile_Engine_Detection:
             MissileShotInterval = MyGuidedMissileConstants.MISSILE_LAUNCHER_SHOT_INTERVAL_IN_MILISECONDS;
             break;
         case MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Guided_Missile_Radar_Detection:
             MissileShotInterval = MyGuidedMissileConstants.MISSILE_LAUNCHER_SHOT_INTERVAL_IN_MILISECONDS;
             break;
         case MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Guided_Missile_Visual_Detection:
             MissileShotInterval = MyGuidedMissileConstants.MISSILE_LAUNCHER_SHOT_INTERVAL_IN_MILISECONDS;
             break;
         default:
             break;
     }
 }