public Pawn(Game game) : base(game) { //Initialize attributes List<Texture2D> _normal = new List<Texture2D>(); _normal.Add(game.Content.Load<Texture2D>("pawn/pawn1")); _normal.Add(game.Content.Load<Texture2D>("pawn/pawn2")); base.animationList.Add((int)EnemyState.NORMAL, _normal); List<Texture2D> _explosion = new List<Texture2D>(); _explosion.Add(game.Content.Load<Texture2D>("enemyexplosion/enemyexplosion1")); _explosion.Add(game.Content.Load<Texture2D>("enemyexplosion/enemyexplosion2")); _explosion.Add(game.Content.Load<Texture2D>("enemyexplosion/enemyexplosion3")); _explosion.Add(game.Content.Load<Texture2D>("enemyexplosion/enemyexplosion4")); base.animationList.Add((int)EnemyState.EXPLOSION, _explosion); base.Initialize(); speed = new Vector2(150f, 150f); pointValue = 10; isAlive = true; position.X = Defines.randomGenerator.Next(MaxX - texture.Width); position.Y = Defines.randomGenerator.Next(MaxY - texture.Height); health = 1; /* Define bounding sphere positions */ //Middle of ship plus 10 units upward int _offset = 5; Vector2 topCenter = new Vector2(center.X, center.Y - _offset); //Middle of ship plus 10 units downward Vector2 bottomCenter = new Vector2(center.Y, center.Y + _offset); sphereCenterList.Add(topCenter); sphereCenterList.Add(bottomCenter); float radius = texture.Width/4; InitializeBoundingSpheres(radius); //Set up particle systems that we'll use. particleManager = Defines.particleManager; if (!particleManager.HasTypeAlready(typeof(ExplosionParticleSystem))) particleManager.Register(new ExplosionParticleSystem(game, 1)); if (!particleManager.HasTypeAlready(typeof(ExplosionSmokeParticleSystem))) particleManager.Register(new ExplosionSmokeParticleSystem(game, 2)); //Set up the bullets for (int i = 0; i < NUM_BULLETS; i++) bullets.Add(new EnemyBullet(game)); bulletOffset = -5; }
protected override void Initialize() { Defines.clientBounds = this.Window.ClientBounds; //Set up the frames counter this.Components.Add(new FPSComponent(this)); //Set up the bloom post-process effect bloomComponent = new BloomComponent(this); bloomComponent.Visible = false; this.Components.Add(bloomComponent); //Set up the console writer. //consoleComponent = new ConsoleComponent(clientBounds); //Set up the sprite managers //playerSpriteManager = new SpriteManagerComponent(this); enemySpriteManager = new SpriteManager(this); //Set up the players //TODO: Only signed in players should be added. playerManager = new PlayerManager(this); // Check whether if two controllers are currently active (Comment to default to two-player mode) // TODO: Add additional check for if the game is currently running or not //if (!GamePad.GetState(PlayerIndex.Two).IsConnected) // twoPlayerMode = false; // Set up the charge Bar chargeBar = new ChargeBar(this); // Set up repair powerup repairPowerup = new RepairPowerup(this); //Set up the particle system manager. particleManager = new ParticleManager(this); base.Initialize(); }