/// <summary>
        /// Factory method for spawning enemies.
        /// </summary>
        /// <param name="enemyType">The type of enemy to spawn</param>
        /// <param name="position">The location to spawn the enemy</param>
        /// <returns></returns>
        public Enemy CreateEnemy(EnemyType enemyType, Vector2 position)
        {
            Enemy enemy;
            uint id = NextID();

            switch (enemyType)
            {
                case EnemyType.Dart:
                    enemy = new Dart(id, content, position);
                    break;

                case EnemyType.GreenGoblin:
                    enemy = new GreenGoblin(id, content, position);
                    break;

                case EnemyType.LaserDrone:
                    enemy = new LaserDrone(id, content, position);
                    break;

                case EnemyType.Cobalt:
                    enemy = new Cobalt(id, content, position);
                    break;

                case EnemyType.JetMinion:
                    enemy = new JetMinion(id, content, position);
                    break;

                case EnemyType.Seed:
                    enemy = new Seed(id, content, position);
                    break;

                case EnemyType.Bomber:
                    enemy = new Bomber(id, content, position);
                    break;

                case EnemyType.Arrow:
                    enemy = new Arrow(id, content, position);
                    break;

                case EnemyType.TurretSingle:
                    enemy = new TurretSingle(id, content, position);
                    break;

                case EnemyType.TurretDouble:
                    enemy = new TurretDouble(id, content, position);
                    break;

                case EnemyType.TurretTower:
                    enemy = new TurretTower(id, content, position);
                    break;

                case EnemyType.StdBaddy:
                    enemy = new StdBaddy(id, content, position);
                    break;

                case EnemyType.BeamShip:
                    enemy = new BeamShip(id, content, position);
                    break;

                case EnemyType.Kamikaze:
                    enemy = new Kamikaze(id, content, position);
                    break;

                case EnemyType.Panzer:
                    enemy = new Panzer(id, content, position);
                    break;

                case EnemyType.Panzer2:
                    enemy = new Panzer2(id, content, position);
                    break;

                case EnemyType.Lavabug:
                    enemy = new Lavabug(id, content, position);
                    break;

                case EnemyType.Lavabug2:
                    enemy = new Lavabug2(id, content, position);
                    break;

                case EnemyType.Mandible:
                    enemy = new Mandible(id, content, position, lavaFlip);
                    lavaFlip = !lavaFlip;
                    break;

                case EnemyType.BladeSpinner:
                    enemy = new BladeSpinner(id, content, position);
                    break;

                case EnemyType.DeerTickDown:
                    enemy = new DeerTick(id, content, position, DeerTickDirection.Straight);
                    break;

                case EnemyType.DeerTickLeft:
                    enemy = new DeerTick(id, content, position, DeerTickDirection.Left);
                    break;

                case EnemyType.DeerTickRight:
                    enemy = new DeerTick(id, content, position, DeerTickDirection.Right);
                    break;

                case EnemyType.Turret:
                    enemy = new Turret(id, content, position);
                    break;

                case EnemyType.JTurret:
                    enemy = new JTurret(id, content, position);
                    break;

                case EnemyType.DrillLeft:
                    enemy = new Drill(id, content, true);
                    break;

                case EnemyType.DrillRight:
                    enemy = new Drill(id, content, false);
                    break;

                case EnemyType.SuicideBomber:
                    enemy = new SuicideBomber(id, content, position);
                    break;

                case EnemyType.LavaFighter:
                    enemy = new LavaFighter(id, content, position);
                    break;

                case EnemyType.TwinJet:
                    enemy = new TwinJet(id, content, position);
                    break;

                case EnemyType.AlienTurret:
                    enemy = new AlienTurret(id, content, position);
                    break;

                case EnemyType.RightClaw:
                    enemy = new RightClaw(id, content, position);
                    break;

                case EnemyType.LeftClaw:
                    enemy = new LeftClaw(id, content, position);
                    break;

                case EnemyType.Bird:
                    enemy = new Bird(id, content, position);
                    break;

                case EnemyType.BrainBoss:
                    enemy = new BrainBoss(id, content, position);
                    break;

                case EnemyType.BrainBossPsyEmitter:
                    enemy = new BrainBossPsiEmitter(id, content, position);
                    break;

                case EnemyType.BrainBossProtection:
                    enemy = new BrainBossProtection(id, content, position);
                    break;

                default:
                    throw new NotImplementedException("The enemy type " + Enum.GetName(typeof(EnemyType), enemyType) + " is not supported");
            }

            enemy.ObjectType = ObjectType.Enemy;
            QueueGameObjectForCreation(enemy);
            return enemy;
        }
Ejemplo n.º 2
0
        public Boss CreateBoss(BossType enemyType, Vector2 position)
        {
            Boss boss;
            uint id = NextID();
            switch (enemyType)
            {
                case BossType.Blimp:
                    boss = new Blimp(id, position, content);
                    QueueGameObjectForCreation(new LeftGun(NextID(), content, boss as Blimp));
                    QueueGameObjectForCreation(new RightGun(NextID(), content, boss as Blimp));
                    break;

                case BossType.TwinJetManager:
                    boss = new TwinJetManager(id, content, position);
                    break;
                case BossType.Bird:
                    boss = new Bird(id, content, position);
                    break;
                default:
                    throw new NotImplementedException("The boss type " + Enum.GetName(typeof(BossType), enemyType) + " is not supported");
            }
            boss.ObjectType = ObjectType.Boss;
            QueueGameObjectForCreation(boss);
            return boss;
        }
        public Boss CreateBoss(BossType enemyType, Vector2 position)
        {
            Boss boss;
            uint id = NextID();
            switch (enemyType)
            {
                case BossType.Blimp:
                    Blimp blimp = new Blimp(id, position, content);
                    LeftGun leftGun = new LeftGun(NextID(), content, blimp);
                    RightGun rightGun = new RightGun(NextID(), content, blimp);
                    leftGun.ObjectType = ObjectType.Boss;
                    rightGun.ObjectType = ObjectType.Boss;
                    blimp.leftGun = leftGun;
                    blimp.rightGun = rightGun;
                    QueueGameObjectForCreation(leftGun);
                    QueueGameObjectForCreation(rightGun);
                    boss = blimp;
                    break;

                case BossType.TwinJetManager:
                    boss = new TwinJetManager(id, content, position);
                    break;

                case BossType.MoonBoss:
                    boss = new MoonBoss(id, content, position);
                    break;
                case BossType.Lavabug:
                    boss = new Lavabug(id, content, position);
                    break;

                case BossType.BrainBoss:
                    boss = new BrainBossWrapper(id, content, position);
                    break;

                case BossType.Bird:
                    boss = new Bird(id, content, position);
                    break;

                default:
                    throw new NotImplementedException("The boss type " + Enum.GetName(typeof(BossType), enemyType) + " is not supported");
            }
            boss.ObjectType = ObjectType.Boss;
            QueueGameObjectForCreation(boss);
            return boss;
        }