/// <summary> /// Factory method for spawning a projectile /// </summary> /// <param name="projectileType">The type of projectile to create</param> /// <param name="position">The position of the projectile in the game world</param> /// <returns>The game object id of the projectile</returns> public Projectile CreateProjectile(ProjectileType projectileType, Vector2 position, Vector2 velocity) { Projectile projectile = null; uint id = NextID(); switch (projectileType) { case ProjectileType.Bullet: projectile = new Bullet(id, content, position); break; case ProjectileType.Fireball: projectile = new Fireball(id, content, position); break; case ProjectileType.BubbleBullet: projectile = new BubbleBullet(id, content, position); break; case ProjectileType.Bomb: projectile = new Bomb(id, content, position, true); break; case ProjectileType.Blades: projectile = new Blades(id, content); break; case ProjectileType.DroneLaser: projectile = new DroneLaser(id, content, position); break; case ProjectileType.ToPlayerBullet: projectile = new ToPlayerBullet(id, content, position); break; case ProjectileType.ArrowProjectile: projectile = new ArrowProjectile(id, content, position); break; case ProjectileType.BirdCrap: projectile = new BirdCrap(id, content, position); break; case ProjectileType.EBullet: projectile = new EBullet(id, content, position); break; case ProjectileType.Frostball: projectile = new Frostball(id, content, position); break; case ProjectileType.BlueBeam: projectile = new blueBeam(id, content, position); break; //This method doesn't fit the trishield very well, so this code is a bit poor in quality. case ProjectileType.TrishieldBall: for (int i = 0; i < 2; i++) { projectile = new TriShieldBall(id, content, 2 * MathHelper.Pi / 3 * i); QueueGameObjectForCreation(projectile); id = NextID(); } projectile = new TriShieldBall(id, content, 4 * MathHelper.Pi / 3); break; case ProjectileType.GenericEnemyBullet: projectile = new GenericEnemyBullet(id, content, position); break; case ProjectileType.DroneWave: // waveIndex helps draw the wave to the left and right of the ship, while waveSpacing holds the vector difference of space between each drone. // Drone count is managed by 2*i. Vector2 waveIndex = new Vector2(-1, 1); Vector2 waveSpacing = new Vector2(40,30); for (int i = 0; i < 5; i++) { projectile = new DroneWave(id, content, position + waveSpacing * waveIndex * i); QueueGameObjectForCreation(projectile); id = NextID(); projectile = new DroneWave(id, content, position + waveSpacing * i); QueueGameObjectForCreation(projectile); id = NextID(); } break; case ProjectileType.TurretFireball: projectile = new TurretFireball(id, content, position); break; case ProjectileType.JetMinionBullet: projectile = new JetMinionBullet(id, content, position); break; case ProjectileType.EnergyBlast: projectile = new EnergyBlast(id, content, position, ScrollingShooterGame.Game.Player.energyBlastLevel); break; case ProjectileType.EnemyBullet: // Bullet velocity float bulletVel = 200f; //ScrollingShooterGame.Game.projectiles.Add(new EnemyBullet(ScrollingShooterGame.Game.Content, this.position + offset, bulletVel * toPlayer)); Vector2 toPlayer = (new Vector2(ScrollingShooterGame.Game.Player.Bounds.Center.X, ScrollingShooterGame.Game.Player.Bounds.Center.Y) - position); toPlayer.Normalize(); projectile = new EnemyBullet(id, content, position, bulletVel * toPlayer); break; case ProjectileType.EnemyBomb: projectile = new Bomb(id, content, position, false); break; case ProjectileType.ShotgunBullet: projectile = new ShotgunBullet(id, content, position, BulletDirection.Straight); QueueGameObjectForCreation(new ShotgunBullet(NextID(), content, position, BulletDirection.Left)); QueueGameObjectForCreation(new ShotgunBullet(NextID(), content, position, BulletDirection.Right)); QueueGameObjectForCreation(new ShotgunBullet(NextID(), content, position, BulletDirection.HardLeft)); QueueGameObjectForCreation(new ShotgunBullet(NextID(), content, position, BulletDirection.HardRight)); break; case ProjectileType.BlimpShotgun: projectile = new BlimpShotgun(id, content, position, BulletDirection.Straight); QueueGameObjectForCreation(new BlimpShotgun(NextID(), content, position, BulletDirection.Left)); QueueGameObjectForCreation(new BlimpShotgun(NextID(), content, position, BulletDirection.Right)); QueueGameObjectForCreation(new BlimpShotgun(NextID(), content, position, BulletDirection.HardLeft)); QueueGameObjectForCreation(new BlimpShotgun(NextID(), content, position, BulletDirection.HardRight)); break; case ProjectileType.Meteor: projectile = new Meteor(id, content, position); break; case ProjectileType.BigMeteor: projectile = new BigMeteor(id, content, position); break; case ProjectileType.EnemyFlameball: projectile = new EnemyFlameball(id, content, position); break; case ProjectileType.RGSabot: projectile = new RGSabot(id, content, position); break; case ProjectileType.BlimpBullet: projectile = new BlimpBullet(id, content, position); break; case ProjectileType.BirdWrath: projectile = new BirdWrath(id, content, position); break; case ProjectileType.FreezewaveProjectile: projectile = new FreezewaveProjectile(id, content, position); break; case ProjectileType.Photon: projectile = new Photon(id, content, position); break; case ProjectileType.Pincher: projectile = new Pincher(id, content, position); break; case ProjectileType.GreenOrb: projectile = new GreenOrb(id, content, position); break; case ProjectileType.AlienTurretOrb: projectile = new AlienTurretOrb(id, content, position); break; case ProjectileType.TwinJetMissile: projectile = new Boss_TwinJetMissile(id, content, position); break; case ProjectileType.TwinJetBullet: projectile = new Boss_TwinJetBullet(id, content, position); break; case ProjectileType.HomingMissile: projectile = new HomingMissileProjectile(content, position, 1, id); break; case ProjectileType.EnemyPsyBall: projectile = new EnemyPsiBall(id, content, position); break; case ProjectileType.EnemyLightningZap: projectile = new EnemyLightningZap(id, content, position); break; default: throw new NotImplementedException("The projectile type " + Enum.GetName(typeof(ProjectileType), projectileType) + " is not supported"); } if ((int)projectileType < 100) projectile.ObjectType = ObjectType.PlayerProjectile; else projectile.ObjectType = ObjectType.EnemyProjectile; QueueGameObjectForCreation(projectile); return projectile; }
/// <summary> /// Updates the LaserDrone /// </summary> /// <param name="elapsedTime">The in-game time between the previous and current frame</param> public override void Update(float elapsedTime) { // Sense the Player's position PlayerShip Player = ScrollingShooterGame.Game.Player; Vector2 PlayerPosition = new Vector2(Player.Bounds.Center.X, Player.Bounds.Center.Y); switch (aiState) { case AIState.Chasing: getInPosition(PlayerPosition, elapsedTime); if (Math.Abs(PlayerPosition.X - Bounds.Center.X) < 40 && Bounds.Center.Y < PlayerPosition.Y) { //transition to firing state fireTimeRemaining = FIRE_TIME; aiState = AIState.Firing; currentSpeed = MAX_MOVE_SPEED * 0.66f; if (droneLaser == null) { droneLaser = (DroneLaser)ScrollingShooterGame.GameObjectManager.CreateProjectile(ProjectileType.DroneLaser, Vector2.Zero); } droneLaser.isOn = true; droneLaser.laserPower = WeaponChargeLevel.Full; droneLaser.updatePosition(position.X + 23, position.Y + 30); } break; case AIState.Firing: fireTimeRemaining -= elapsedTime; //change to medium charge sprite when halfway depleted if (weaponChargeLevel == WeaponChargeLevel.Full && fireTimeRemaining / FIRE_TIME < 0.66) { weaponChargeLevel = droneLaser.laserPower = WeaponChargeLevel.Medium; } else if (weaponChargeLevel == WeaponChargeLevel.Medium && fireTimeRemaining / FIRE_TIME < 0.33) { weaponChargeLevel = droneLaser.laserPower = WeaponChargeLevel.Low; } if (fireTimeRemaining <= 0) { //transition to recharging state aiState = AIState.Recharging; currentSpeed = MAX_MOVE_SPEED * 0.33f; rechargeTimeRemaining = RECHARGE_TIME; weaponChargeLevel = WeaponChargeLevel.Low; droneLaser.isOn = false; } getInPosition(PlayerPosition, elapsedTime); droneLaser.updatePosition(position.X + 23, position.Y + 30); break; case AIState.Recharging: rechargeTimeRemaining -= elapsedTime; if (weaponChargeLevel == WeaponChargeLevel.Low && rechargeTimeRemaining / RECHARGE_TIME < 0.66) { weaponChargeLevel = WeaponChargeLevel.Medium; } if (weaponChargeLevel == WeaponChargeLevel.Medium && rechargeTimeRemaining / RECHARGE_TIME < 0.33) { weaponChargeLevel = WeaponChargeLevel.Full; } if (rechargeTimeRemaining <= 0) { aiState = AIState.Chasing; currentSpeed = MAX_MOVE_SPEED; weaponChargeLevel = WeaponChargeLevel.Full; } moveAwayFrom(PlayerPosition, elapsedTime); break; } }
/// <summary> /// Updates the LaserDrone /// </summary> /// <param name="elapsedTime">The in-game time between the previous and current frame</param> public override void Update(float elapsedTime) { // Sense the player's position PlayerShip player = ScrollingShooterGame.Game.Player; Vector2 playerPosition = new Vector2(player.Bounds.Center.X, player.Bounds.Center.Y); switch (aiState) { case AIState.Chasing: getInPosition(playerPosition, elapsedTime); if (Math.Abs(playerPosition.X - Bounds.Center.X) < 40 && Bounds.Center.Y < playerPosition.Y) { //transition to firing state fireTimeRemaining = FIRE_TIME; aiState = AIState.Firing; currentSpeed = MAX_MOVE_SPEED * 0.66f; if(droneLaser == null) droneLaser = (DroneLaser) ScrollingShooterGame.GameObjectManager.CreateProjectile(ProjectileType.DroneLaser, Vector2.Zero); droneLaser.isOn = true; droneLaser.laserPower = WeaponChargeLevel.Full; droneLaser.updatePosition(position.X + 23, position.Y + 30); } break; case AIState.Firing: fireTimeRemaining -= elapsedTime; //change to medium charge sprite when halfway depleted if (weaponChargeLevel == WeaponChargeLevel.Full && fireTimeRemaining / FIRE_TIME < 0.66) weaponChargeLevel = droneLaser.laserPower = WeaponChargeLevel.Medium; else if (weaponChargeLevel == WeaponChargeLevel.Medium && fireTimeRemaining / FIRE_TIME < 0.33) weaponChargeLevel = droneLaser.laserPower = WeaponChargeLevel.Low; if (fireTimeRemaining <= 0) { //transition to recharging state aiState = AIState.Recharging; currentSpeed = MAX_MOVE_SPEED * 0.33f; rechargeTimeRemaining = RECHARGE_TIME; weaponChargeLevel = WeaponChargeLevel.Low; droneLaser.isOn = false; } getInPosition(playerPosition, elapsedTime); droneLaser.updatePosition(position.X + 23, position.Y + 30); break; case AIState.Recharging: rechargeTimeRemaining -= elapsedTime; if (weaponChargeLevel == WeaponChargeLevel.Low && rechargeTimeRemaining / RECHARGE_TIME < 0.66) weaponChargeLevel = WeaponChargeLevel.Medium; if (weaponChargeLevel == WeaponChargeLevel.Medium && rechargeTimeRemaining / RECHARGE_TIME < 0.33) weaponChargeLevel = WeaponChargeLevel.Full; if (rechargeTimeRemaining <= 0) { aiState = AIState.Chasing; currentSpeed = MAX_MOVE_SPEED; weaponChargeLevel = WeaponChargeLevel.Full; } moveAwayFrom(playerPosition, elapsedTime); break; } }
/// <summary> /// Factory method for spawning a projectile /// </summary> /// <param name="projectileType">The type of projectile to create</param> /// <param name="position">The position of the projectile in the game world</param> /// <returns>The game object id of the projectile</returns> public Projectile CreateProjectile(ProjectileType projectileType, Vector2 position) { Projectile projectile; uint id = NextID(); switch (projectileType) { case ProjectileType.Bullet: projectile = new Bullet(id, content, position); break; case ProjectileType.Fireball: projectile = new Fireball(id, content, position); break; case ProjectileType.BubbleBullet: projectile = new BubbleBullet(id, content, position); break; case ProjectileType.Bomb: projectile = new Bomb(id, content, position, true); break; case ProjectileType.Blades: projectile = new Blades(id, content); break; case ProjectileType.DroneLaser: projectile = new DroneLaser(id, content, position); break; case ProjectileType.ToPlayerBullet: projectile = new ToPlayerBullet(id, content, position); break; case ProjectileType.ArrowProjectile: projectile = new ArrowProjectile(id, content, position); break; case ProjectileType.BirdCrap: projectile = new BirdCrap(id, content, position); break; case ProjectileType.EBullet: projectile = new EBullet(id, content, position); break; case ProjectileType.Frostball: projectile = new Frostball(id, content, position); break; case ProjectileType.BlueBeam: projectile = new blueBeam(id, content, position); break; //This method doesn't fit the trishield very well, so this code is a bit poor in quality. case ProjectileType.TrishieldBall: for (int i = 0; i < 2; i++) { projectile = new TriShieldBall(id, content, 2 * MathHelper.Pi / 3 * i); QueueGameObjectForCreation(projectile); id = NextID(); } projectile = new TriShieldBall(id, content, 4 * MathHelper.Pi / 3); break; case ProjectileType.GenericEnemyBullet: projectile = new GenericEnemyBullet(id, content, position); break; case ProjectileType.DroneWave: // waveIndex helps draw the wave to the left and right of the ship, while waveSpacing holds the vector difference of space between each drone. // Drone count is managed by 2*i. Vector2 waveIndex = new Vector2(-1, 1); Vector2 waveSpacing = new Vector2(40, 30); for (int i = 0; i < 5; i++) { projectile = new DroneWave(id, content, position + waveSpacing * waveIndex * i); QueueGameObjectForCreation(projectile); id = NextID(); projectile = new DroneWave(id, content, position + waveSpacing * i); QueueGameObjectForCreation(projectile); id = NextID(); } projectile = new DroneWave(id, content, position + waveSpacing * waveIndex * 6); QueueGameObjectForCreation(projectile); id = NextID(); projectile = new DroneWave(id, content, position + waveSpacing * 6); break; case ProjectileType.TurretFireball: projectile = new TurretFireball(id, content, position); break; case ProjectileType.JetMinionBullet: projectile = new JetMinionBullet(id, content, position); break; case ProjectileType.EnergyBlast: projectile = new EnergyBlast(id, content, position, ScrollingShooterGame.Game.Player.energyBlastLevel); break; case ProjectileType.EnemyBullet: // Bullet velocity float bulletVel = 200f; //ScrollingShooterGame.Game.projectiles.Add(new EnemyBullet(ScrollingShooterGame.Game.Content, this.position + offset, bulletVel * toPlayer)); Vector2 toPlayer = (new Vector2(ScrollingShooterGame.Game.Player.Bounds.Center.X, ScrollingShooterGame.Game.Player.Bounds.Center.Y) - position); toPlayer.Normalize(); projectile = new EnemyBullet(id, content, position, bulletVel * toPlayer); break; case ProjectileType.EnemyBomb: projectile = new Bomb(id, content, position, false); break; case ProjectileType.ShotgunBullet: projectile = new ShotgunBullet(id, content, position, BulletDirection.Straight); QueueGameObjectForCreation(new ShotgunBullet(NextID(), content, position, BulletDirection.Left)); QueueGameObjectForCreation(new ShotgunBullet(NextID(), content, position, BulletDirection.Right)); QueueGameObjectForCreation(new ShotgunBullet(NextID(), content, position, BulletDirection.HardLeft)); QueueGameObjectForCreation(new ShotgunBullet(NextID(), content, position, BulletDirection.HardRight)); break; case ProjectileType.Meteor: projectile = new Meteor(id, content, position); break; case ProjectileType.BigMeteor: projectile = new BigMeteor(id, content, position); break; case ProjectileType.EnemyFlameball: projectile = new EnemyFlameball(id, content, position); break; case ProjectileType.RGSabot: projectile = new RGSabot(id, content, position); break; case ProjectileType.Photon: projectile = new Photon(id, content, position); break; default: throw new NotImplementedException("The projectile type " + Enum.GetName(typeof(ProjectileType), projectileType) + " is not supported"); } QueueGameObjectForCreation(projectile); return(projectile); }
/// <summary> /// Creates a new instance of a Bird boss /// </summary> /// <param name="content">A ContentManager to load resources with</param> /// <param name="position">The position of the Bird boss in the game world</param> public Bird(uint id, ContentManager content, Vector2 position) : base(id) { position.Y += 800; this.position = position; ScrollingShooterGame.LevelManager.Scrolling = true; this.Health = 100; this.position = position; spritesheet = content.Load<Texture2D>("Spritesheets/newsh0.shp.000001"); spriteBounds[0].X = 3; spriteBounds[0].Y = 0; spriteBounds[0].Width = 187; spriteBounds[0].Height = 84; spriteBoundsAnim[2].X = 48; spriteBoundsAnim[2].Y = 84; spriteBoundsAnim[2].Width = 23; spriteBoundsAnim[2].Height = 25; spriteBoundsAnim[1].X = 72; spriteBoundsAnim[1].Y = 84; spriteBoundsAnim[1].Width = 23; spriteBoundsAnim[1].Height = 25; spriteBoundsAnim[0].X = 96; spriteBoundsAnim[0].Y = 84; spriteBoundsAnim[0].Width = 23; spriteBoundsAnim[0].Height = 25; spriteBoundsAnim[3].X = 168; spriteBoundsAnim[3].Y = 84; spriteBoundsAnim[3].Width = 23; spriteBoundsAnim[3].Height = 25; spriteBoundsLaser[0].X = 123; spriteBoundsLaser[0].Y = 84; spriteBoundsLaser[0].Width = 19; spriteBoundsLaser[0].Height = 23; spriteBoundsLaser[1].X = 147; spriteBoundsLaser[1].Y = 84; spriteBoundsLaser[1].Width = 19; spriteBoundsLaser[1].Height = 23; spriteBoundsLaser[2].X = 195; spriteBoundsLaser[2].Y = 84; spriteBoundsLaser[2].Width = 19; spriteBoundsLaser[2].Height = 23; beakPosition.X = (spriteBounds[0].Width / 2) + 8; beakPosition.Y = spriteBounds[0].Height + spriteBoundsAnim[0].Height; LeftLaserPosition.X = (spriteBounds[0].Width / 2) + 49; LeftLaserPosition.Y = spriteBounds[0].Height + spriteBoundsLaser[0].Height - 30; RightLaserPosition.X = (spriteBounds[0].Width / 2) - 49; RightLaserPosition.Y = spriteBounds[0].Height + spriteBoundsLaser[0].Height - 30; LeftLaser = (DroneLaser)ScrollingShooterGame.GameObjectManager.CreateProjectile(ProjectileType.DroneLaser, LeftLaserPosition); LeftLaser.isOn = laserStatus; LeftLaser.laserPower = WeaponChargeLevel.Low; RightLaser = (DroneLaser)ScrollingShooterGame.GameObjectManager.CreateProjectile(ProjectileType.DroneLaser, RightLaserPosition); RightLaser.isOn = laserStatus; RightLaser.laserPower = WeaponChargeLevel.Low; BES = birdEntranceState.flyOver; scream = content.Load<SoundEffect>("SFX/hawk_scream"); scream.Play(); fire = content.Load<SoundEffect>("SFX/bird_fire"); hurt = content.Load<SoundEffect>("SFX/hurt_scream"); death = content.Load<SoundEffect>("SFX/death_scream"); }
/// <summary> /// Creates a new instance of a Bird boss /// </summary> /// <param name="content">A ContentManager to load resources with</param> /// <param name="position">The position of the Bird boss in the game world</param> public Bird(uint id, ContentManager content, Vector2 position) : base(id) { this.position = new Vector2(300, 800); //ScrollingShooterGame.LevelManager.Scrolling = false; this.position = position; spritesheet = content.Load <Texture2D>("Spritesheets/newsh0.shp.000001"); spriteBounds[0].X = 3; spriteBounds[0].Y = 0; spriteBounds[0].Width = 187; spriteBounds[0].Height = 84; spriteBoundsAnim[2].X = 48; spriteBoundsAnim[2].Y = 84; spriteBoundsAnim[2].Width = 23; spriteBoundsAnim[2].Height = 25; spriteBoundsAnim[1].X = 72; spriteBoundsAnim[1].Y = 84; spriteBoundsAnim[1].Width = 23; spriteBoundsAnim[1].Height = 25; spriteBoundsAnim[0].X = 96; spriteBoundsAnim[0].Y = 84; spriteBoundsAnim[0].Width = 23; spriteBoundsAnim[0].Height = 25; spriteBoundsAnim[3].X = 168; spriteBoundsAnim[3].Y = 84; spriteBoundsAnim[3].Width = 23; spriteBoundsAnim[3].Height = 25; spriteBoundsLaser[0].X = 123; spriteBoundsLaser[0].Y = 84; spriteBoundsLaser[0].Width = 19; spriteBoundsLaser[0].Height = 23; spriteBoundsLaser[1].X = 147; spriteBoundsLaser[1].Y = 84; spriteBoundsLaser[1].Width = 19; spriteBoundsLaser[1].Height = 23; spriteBoundsLaser[2].X = 195; spriteBoundsLaser[2].Y = 84; spriteBoundsLaser[2].Width = 19; spriteBoundsLaser[2].Height = 23; beakPosition.X = (spriteBounds[0].Width / 2) + 8; beakPosition.Y = spriteBounds[0].Height + spriteBoundsAnim[0].Height; LeftLaserPosition.X = (spriteBounds[0].Width / 2) + 49; LeftLaserPosition.Y = spriteBounds[0].Height + spriteBoundsLaser[0].Height - 30; RightLaserPosition.X = (spriteBounds[0].Width / 2) - 49; RightLaserPosition.Y = spriteBounds[0].Height + spriteBoundsLaser[0].Height - 30; LeftLaser = (DroneLaser)ScrollingShooterGame.GameObjectManager.CreateProjectile(ProjectileType.DroneLaser, LeftLaserPosition); LeftLaser.isOn = laserStatus; LeftLaser.laserPower = WeaponChargeLevel.Low; RightLaser = (DroneLaser)ScrollingShooterGame.GameObjectManager.CreateProjectile(ProjectileType.DroneLaser, RightLaserPosition); RightLaser.isOn = laserStatus; RightLaser.laserPower = WeaponChargeLevel.Low; BES = birdEntranceState.flyOver; }
/// <summary> /// Factory method for spawning a projectile /// </summary> /// <param name="projectileType">The type of projectile to create</param> /// <param name="position">The position of the projectile in the game world</param> /// <returns>The game object id of the projectile</returns> public Projectile CreateProjectile(ProjectileType projectileType, Vector2 position, Vector2 velocity) { Projectile projectile; uint id = NextID(); switch (projectileType) { case ProjectileType.Bullet: projectile = new Bullet(id, content, position); break; case ProjectileType.Fireball: projectile = new Fireball(id, content, position); break; case ProjectileType.BubbleBullet: projectile = new BubbleBullet(id, content, position); break; case ProjectileType.Bomb: projectile = new Bomb(id, content, position, true); break; case ProjectileType.Blades: projectile = new Blades(id, content); break; case ProjectileType.DroneLaser: projectile = new DroneLaser(id, content, position); break; case ProjectileType.ToPlayerBullet: projectile = new ToPlayerBullet(id, content, position); break; case ProjectileType.ArrowProjectile: projectile = new ArrowProjectile(id, content, position); break; case ProjectileType.BirdCrap: projectile = new BirdCrap(id, content, position); break; case ProjectileType.EBullet: projectile = new EBullet(id, content, position); break; case ProjectileType.Frostball: projectile = new Frostball(id, content, position); break; case ProjectileType.BlueBeam: projectile = new blueBeam(id, content, position); break; //This method doesn't fit the trishield very well, so this code is a bit poor in quality. case ProjectileType.TrishieldBall: for (int i = 0; i < 2; i++) { projectile = new TriShieldBall(id, content, 2 * MathHelper.Pi / 3 * i); QueueGameObjectForCreation(projectile); id = NextID(); } projectile = new TriShieldBall(id, content, 4 * MathHelper.Pi / 3); break; case ProjectileType.GenericEnemyBullet: projectile = new GenericEnemyBullet(id, content, position); break; case ProjectileType.DroneWave: // waveIndex helps draw the wave to the left and right of the ship, while waveSpacing holds the vector difference of space between each drone. // Drone count is managed by 2*i. Vector2 waveIndex = new Vector2(-1, 1); Vector2 waveSpacing = new Vector2(40, 30); for (int i = 0; i < 5; i++) { projectile = new DroneWave(id, content, position + waveSpacing * waveIndex * i); QueueGameObjectForCreation(projectile); id = NextID(); projectile = new DroneWave(id, content, position + waveSpacing * i); QueueGameObjectForCreation(projectile); id = NextID(); } projectile = new DroneWave(id, content, position + waveSpacing * waveIndex * 6); QueueGameObjectForCreation(projectile); id = NextID(); projectile = new DroneWave(id, content, position + waveSpacing * 6); break; case ProjectileType.TurretFireball: projectile = new TurretFireball(id, content, position); break; case ProjectileType.JetMinionBullet: projectile = new JetMinionBullet(id, content, position); break; case ProjectileType.EnergyBlast: projectile = new EnergyBlast(id, content, position, (int)velocity.X); break; case ProjectileType.EnemyBullet: projectile = new EnemyBullet(id, content, position, velocity); break; case ProjectileType.EnemyTurretTowerBullet: projectile = new EnemyTurretTowerBullet(id, content, position, velocity); break; case ProjectileType.EnemyBomb: projectile = new Bomb(id, content, position, false); break; case ProjectileType.ShotgunBullet: projectile = new ShotgunBullet(id, content, position, BulletDirection.Straight); QueueGameObjectForCreation(new ShotgunBullet(NextID(), content, position, BulletDirection.Left)); QueueGameObjectForCreation(new ShotgunBullet(NextID(), content, position, BulletDirection.Right)); QueueGameObjectForCreation(new ShotgunBullet(NextID(), content, position, BulletDirection.HardLeft)); QueueGameObjectForCreation(new ShotgunBullet(NextID(), content, position, BulletDirection.HardRight)); break; case ProjectileType.Meteor: projectile = new Meteor(id, content, position); break; case ProjectileType.BigMeteor: projectile = new BigMeteor(id, content, position); break; case ProjectileType.EnemyFlameball: projectile = new EnemyFlameball(id, content, position); break; case ProjectileType.RGSabot: projectile = new RGSabot(id, content, position); break; default: throw new NotImplementedException("The projectile type " + Enum.GetName(typeof(ProjectileType), projectileType) + " is not supported"); } // Set the objectType to player or enemy projectile depending on enum value int type = (int)projectileType; if (type < 100) projectile.objectType = ObjectType.playerProjectile; else projectile.objectType = ObjectType.enemyProjectile; QueueGameObjectForCreation(projectile); return projectile; }