Esempio n. 1
0
        /// <summary>
        /// Creates a new brain boss
        /// </summary>
        /// <param name="id">The game id to assign to the new object</param>
        /// <param name="content">A ContentManager to load content from</param>
        /// <param name="position">A position on the screen</param>
        public BrainBoss(uint id, ContentManager content, Vector2 position)
            : base(id)
        {
            this.brainSpritesheet  = content.Load <Texture2D>("Spritesheets/newsh5.shp.000000");
            this.psiOrbSpritesheet = content.Load <Texture2D>("Spritesheets/tyrian.shp.000000");

            this.brainSpriteBounds = new Rectangle(60, 143, 73, 80);
            this.psiOrbBounds      = new Rectangle(121, 172, 21, 21);
            this.psiOrbOrigin      = new Vector2(psiOrbBounds.Width / 2, psiOrbBounds.Height / 2);

            psiOrbOffset.X = brainSpriteBounds.Width / 2;
            psiOrbOffset.Y = brainSpriteBounds.Height / 2;

            this.Health = 100;

            this.position = position;

            centerOffset = new Vector2(brainSpriteBounds.Width / 2, brainSpriteBounds.Height / 2);

            psiEmitter = ScrollingShooterGame.GameObjectManager.CreateEnemy(EnemyType.BrainBossPsyEmitter, position + centerOffset) as BrainBossPsiEmitter;

            protection = ScrollingShooterGame.GameObjectManager.CreateEnemy(EnemyType.BrainBossProtection, position + centerOffset) as BrainBossProtection;

            targetPositionX = (int)position.X;
            targetPositionY = (int)(position.Y + ScrollingShooterGame.Game.GraphicsDevice.Viewport.Height / 5 - brainSpriteBounds.Height / 2);
        }
Esempio n. 2
0
        /// <summary>
        /// Creates a new brain boss
        /// </summary>
        /// <param name="id">The game id to assign to the new object</param>
        /// <param name="content">A ContentManager to load content from</param>
        /// <param name="position">A position on the screen</param>
        public BrainBoss(uint id, ContentManager content, Vector2 position)
            : base(id)
        {
            this.brainSpritesheet = content.Load<Texture2D>("Spritesheets/newsh5.shp.000000");
            this.psiOrbSpritesheet = content.Load<Texture2D>("Spritesheets/tyrian.shp.000000");

            this.brainSpriteBounds = new Rectangle(60, 143, 73, 80);
            this.psiOrbBounds = new Rectangle(121, 172, 21, 21);
            this.psiOrbOrigin = new Vector2(psiOrbBounds.Width / 2, psiOrbBounds.Height / 2);

            psiOrbOffset.X = brainSpriteBounds.Width / 2;
            psiOrbOffset.Y = brainSpriteBounds.Height / 2;

            this.Health = 100;

            this.position = position;

            centerOffset = new Vector2(brainSpriteBounds.Width / 2, brainSpriteBounds.Height / 2);

            psiEmitter = ScrollingShooterGame.GameObjectManager.CreateEnemy(EnemyType.BrainBossPsyEmitter, position + centerOffset) as BrainBossPsiEmitter;

            protection = ScrollingShooterGame.GameObjectManager.CreateEnemy(EnemyType.BrainBossProtection, position + centerOffset) as BrainBossProtection;

            targetPositionX = (int)position.X;
            targetPositionY = (int)(position.Y + ScrollingShooterGame.Game.GraphicsDevice.Viewport.Height / 5 - brainSpriteBounds.Height / 2);
        }
        /// <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;
        }
Esempio n. 4
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.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;

            case EnemyType.Mine:
                enemy = new Mine(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>
        /// Creates a new brain boss
        /// </summary>
        /// <param name="id">The game id to assign to the new object</param>
        /// <param name="content">A ContentManager to load content from</param>
        /// <param name="position">A position on the screen</param>
        public BrainBoss(uint id, ContentManager content, Vector2 position)
            : base(id)
        {
            this.brainSpritesheet = content.Load<Texture2D>("Spritesheets/newsh5.shp.000000");
            this.psiOrbSpritesheet = content.Load<Texture2D>("Spritesheets/tyrian.shp.000000");

            this.brainSpriteBounds = new Rectangle(60, 143, 73, 80);
            this.psiOrbBounds = new Rectangle(121, 172, 21, 21);
            this.psiOrbOrigin = new Vector2(psiOrbBounds.Width / 2, psiOrbBounds.Height / 2);

            psiOrbOffset.X = brainSpriteBounds.Width / 2;
            psiOrbOffset.Y = brainSpriteBounds.Height / 2;

            this.position = position;

            centerOffset = new Vector2(brainSpriteBounds.Width / 2, brainSpriteBounds.Height / 2);

            psiEmitter = ScrollingShooterGame.GameObjectManager.CreateEnemy(EnemyType.BrainBossPsyEmitter, position + centerOffset) as BrainBossPsiEmitter;

            protection = ScrollingShooterGame.GameObjectManager.CreateEnemy(EnemyType.BrainBossProtection, position + centerOffset);
            //TODO: add protection organs for initial stage

             screenCenterX = ScrollingShooterGame.Game.GraphicsDevice.Viewport.Width / 2 - brainSpriteBounds.Width / 2;
             screenCenterY = ScrollingShooterGame.Game.GraphicsDevice.Viewport.Height / 2 - brainSpriteBounds.Height / 2;
        }