private void FireShotGunShot(MyAmmoProperties ammoProperties) { int currentRound = ammoProperties.ProjectileGroupSize; float deviateAngle = ammoProperties.DeviateAngle; // Create one projectile - but deviate projectile direction be random angle if (IsThisGunFriendly()) { deviateAngle += MyGameplayConstants.GameplayDifficultyProfile.DeviatingAnglePlayerOnEnemy; } else { deviateAngle += MyGameplayConstants.GameplayDifficultyProfile.DeviatingAngleEnemyBotOnPlayer; } while (currentRound-- > 0) { Vector3 projectileForwardVector = MyUtilRandomVector3ByDeviatingVector.GetRandom(WorldMatrix.Forward, deviateAngle); float billboardSize = ammoProperties.AmmoType == MyAmmoType.Explosive ? 2 : 1; MyProjectiles.AddShotgun(ammoProperties, Parent, m_positionMuzzleInWorldSpace, Vector3.Zero /* Parent.Physics.LinearVelocity*/, projectileForwardVector, currentRound % MyShotgunConstants.PROJECTILE_GROUP_SIZE == 0, 2, this, billboardSize, Parent); } m_lastTimeShoot = MyMinerGame.TotalGamePlayTimeInMilliseconds; AddWeaponCue(ammoProperties.ShotSound); }
protected void AddProjectile(MyAmmoProperties ammoProperties, Vector3 muzzlePosition) { float deviateAngle = ammoProperties.DeviateAngle; Vector3 projectileForwardVector = GetDeviatedVector(ammoProperties); Vector3 velocity = ((MyLargeShipGunBase)Parent).PrefabParent.Parent.Physics.LinearVelocity; MyProjectiles.Add(ammoProperties, Parent, muzzlePosition, velocity, projectileForwardVector, false, 1.0f, this, ((MyLargeShipGunBase)Parent).WeaponOwner); }
public void Explode(MyEntity collideEntity) { if (m_usedAmmo.AmmoType == MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Cannon_Proximity_Explosive) { //make flying shrapnels int shrapnels = MyCannonShotConstants.PROXIMITY_SHRAPNELS_COUNT; while (shrapnels-- > 0) { Vector3 projectileForwardVector = MyUtilRandomVector3ByDeviatingVector.GetRandom(WorldMatrix.Forward, MathHelper.TwoPi); //MyProjectiles.Add( // MyAmmoConstants.GetAmmoProperties(MyAmmoPropertiesEnum.Shrapnel), //Parent, GetPosition(), Vector3.Zero, projectileForwardVector, false, 3, this); MyProjectiles.Add( MyAmmoConstants.GetAmmoProperties(MyAmmoPropertiesEnum.Shrapnel), Parent, GetPosition(), Vector3.Zero, projectileForwardVector, false, 3, this); } } Explode(); }
protected void AddProjectile(MyAmmoProperties ammoProperties, MyEntity weapon) { Vector3 projectileForwardVector = GetDeviatedVector(ammoProperties); MyProjectiles.Add(ammoProperties, Parent, m_positionMuzzleInWorldSpace, Parent.Physics.LinearVelocity, projectileForwardVector, false, 1.0f, weapon); }