/// <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 Powerup CreatePowerup(PowerupType powerupType, Vector2 position) { Powerup powerup; uint id = NextID(); switch (powerupType) { case PowerupType.Fireball: powerup = new FireballPowerup(id, content, position); break; case PowerupType.Frostball: powerup = new FrostballPowerup(id, content, position); break; case PowerupType.BubbleBeam: powerup = new BubbleBeamPowerup(id, content, position); break; case PowerupType.Freezewave: powerup = new FreezewavePowerup(id, content, position); break; case PowerupType.Blades: powerup = new BladesPowerup(id, content, position); break; case PowerupType.EightBallShield: //added EightBallShield powerup = new EightBallShieldPowerup(id, content, position); break; case PowerupType.TriShield: powerup = new TriShieldPowerup(id, content, position); break; case PowerupType.DroneWave: powerup = new DroneWavePowerup(id, content, position); break; case PowerupType.Birdcrap: powerup = new BirdcrapPowerup(id, content, position); break; case PowerupType.EnergyBlast: powerup = new EnergyBlastPowerup(id, content, position); break; case PowerupType.Bomb: powerup = new BombPowerUp(id, content, position); break; case PowerupType.Ale: powerup = new AlePowerup(id, content, position); break; case PowerupType.ShotgunPowerup: powerup = new ShotgunPowerup(id, content, position); break; case PowerupType.MeteorPowerup: powerup = new MeteorPowerup(id, content, position); break; case PowerupType.Railgun: powerup = new Railgun(id, content, position); break; case PowerupType.HomingMissiles: powerup = new HomingMissilesPowerup(id, content, position); break; default: throw new NotImplementedException("The powerup type " + Enum.GetName(typeof(ProjectileType), powerupType) + " is not supported"); } powerup.ObjectType = ObjectType.Powerup; QueueGameObjectForCreation(powerup); return powerup; }
/// <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 Powerup CreatePowerup(PowerupType powerupType, Vector2 position) { Powerup powerup; uint id = NextID(); switch (powerupType) { case PowerupType.Fireball: powerup = new FireballPowerup(id, content, position); break; case PowerupType.BubbleBeam: powerup = new BubbleBeamPowerup(id, content, position); break; case PowerupType.Freezewave: powerup = new FreezewavePowerup(id, content, position); break; case PowerupType.Blades: powerup = new BladesPowerup(id, content, position); break; case PowerupType.EightBallShield: //added EightBallShield powerup = new EightBallShieldPowerup(id, content, position); break; case PowerupType.TriShield: powerup = new TriShieldPowerup(id, content, position); break; case PowerupType.DroneWave: powerup = new DroneWavePowerup(id, content, position); break; case PowerupType.Birdcrap: powerup = new BirdcrapPowerup(id, content, position); break; case PowerupType.EnergyBlast: powerup = new EnergyBlastPowerup(id, content, position); break; case PowerupType.Bomb: powerup = new BombPowerUp(id, content, position); break; case PowerupType.Ale: powerup = new AlePowerup(id, content, position); break; case PowerupType.ShotgunPowerup: powerup = new ShotgunPowerup(id, content, position); break; case PowerupType.MeteorPowerup: powerup = new MeteorPowerup(id, content, position); break; case PowerupType.Railgun: powerup = new Railgun(id, content, position); break; case PowerupType.HomingMissiles: powerup = new HomingMissilesPowerup(id, content, position); break; default: throw new NotImplementedException("The powerup type " + Enum.GetName(typeof(PowerupType), powerupType) + " is not supported"); } QueueGameObjectForCreation(powerup); return(powerup); }