Ejemplo n.º 1
0
        /// <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.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;
        }
        /// <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.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.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;

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

            QueueGameObjectForCreation(enemy);
            return enemy;
        }