public static void placeEnemyBullet(GameObject obj, int damage, List<DamageBullet> bullets, int type, BoundingFrustum cameraFrustum, float offsetFactor) { HydroBot tmp1; SwimmingObject tmp2; Matrix orientationMatrix; if (obj.GetType().Name.Equals("HydroBot")) { tmp1 = (HydroBot)obj; orientationMatrix = Matrix.CreateRotationY(tmp1.ForwardDirection); } else { tmp2 = (SwimmingObject)obj; orientationMatrix = Matrix.CreateRotationY(tmp2.ForwardDirection); } DamageBullet newBullet = new DamageBullet(); Vector3 movement = Vector3.Zero; movement.Z = 1; Vector3 shootingDirection = Vector3.Transform(movement, orientationMatrix); newBullet.initialize(obj.Position + shootingDirection * offsetFactor, shootingDirection, GameConstants.BulletSpeed, damage, (BaseEnemy)obj); if (type == 1) { newBullet.loadContent(PoseidonGame.contentManager, "Models/BulletModels/bossBullet"); if (obj.BoundingSphere.Intersects(cameraFrustum)) PoseidonGame.audio.bossShot.Play(); } else if (type == 0) { newBullet.loadContent(PoseidonGame.contentManager, "Models/BulletModels/normalbullet"); if (obj.BoundingSphere.Intersects(cameraFrustum)) PoseidonGame.audio.enemyShot.Play(); } bullets.Add(newBullet); }
public static void placeBotDamageBullet(HydroBot hydroBot, ContentManager Content, List<DamageBullet> myBullet, GameMode gameMode) { DamageBullet d = new DamageBullet(); Matrix orientationMatrix = Matrix.CreateRotationY(hydroBot.ForwardDirection); Vector3 movement = Vector3.Zero; movement.Z = 1; Vector3 shootingDirection = Vector3.Transform(movement, orientationMatrix); d.initialize(hydroBot.Position + shootingDirection * 15, shootingDirection, GameConstants.BulletSpeed, HydroBot.strength, HydroBot.strengthUp, gameMode); d.loadContent(Content, "Models/BulletModels/damageBullet"); PoseidonGame.audio.botNormalShot.Play(); myBullet.Add(d); }