/** * Drawing the models of course * * **/ public void Draw(Camera camera) { Matrix[] transforms = new Matrix[model.Bones.Count]; model.CopyAbsoluteBoneTransformsTo(transforms); foreach (ModelMesh mesh in model.Meshes) { foreach (BasicEffect be in mesh.Effects) { be.EnableDefaultLighting(); be.Projection = camera.projection; be.View = camera.view; be.World = GetWorld(); //* mesh.ParentBone.Transform; } mesh.Draw(); } }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { //Initialize Camera camera = new Camera(this, new Vector3(0.0f, 0.0f, 500.0f), Vector3.Zero, Vector3.Up); Components.Add(camera); rand = new Random(3); modelManager = new ModelManager(this); Components.Add(modelManager); //Initialize base.Initialize(); }
public void LoadContent(ContentManager content) { // Load particles particleManager.addEffect("SMALL_EXPLOSION", content.Load<ParticleEffect>("Particle Effects/Explosion-Red")); particleManager.addEffect("SMALL_EXPLOSION2", content.Load<ParticleEffect>("Particle Effects/Explosion-Orange")); particleManager.addEffect("MEDIUM_EXPLOSION_PINK", content.Load<ParticleEffect>("Particle Effects/Explosion-Medium-Pink")); particleManager.addEffect("LARGE_EXPLOSION_BLUE", content.Load<ParticleEffect>("Particle Effects/Large-Explosion-Blue-Remake")); particleManager.addEffect("Ship-Trail-Blue", content.Load<ParticleEffect>("Particle Effects/Ship-Trail-Blue")); particleManager.addEffect("MissleTrail-Orange", content.Load<ParticleEffect>("Particle Effects/MissleTrail-Orange")); particleManager.addEffect("Ricoshet", content.Load<ParticleEffect>("Particle Effects/Ricochet-Yellow")); particleManager.addEffect("WarpIn", content.Load<ParticleEffect>("Particle Effects/WarpIn2")); particleManager.LoadContent(content); score = content.Load<SpriteFont>("Fonts/scoreFont"); livesIcon = content.Load<Texture2D>("lives_icon"); background = new Background(content.Load<Texture2D>("grid_background")); player = new Player(content.Load<Texture2D>("PlayerShip")); crosshair = content.Load<Texture2D>("crosshair"); // Load enemy textures enemyManager = new EnemyManager(player); enemyManager.enemyTextures.Add("SMALL_ASTEROID_RED", content.Load<Texture2D>("SMALL_ASTEROID_RED")); enemyManager.enemyTextures.Add("SMALL_ASTEROID_BLUE", content.Load<Texture2D>("SMALL_ASTEROID_BLUE")); enemyManager.enemyTextures.Add("SMALL_ASTEROID_GREEN", content.Load<Texture2D>("SMALL_ASTEROID_GREEN")); enemyManager.enemyTextures.Add("SMALL_ASTEROID_PINK", content.Load<Texture2D>("SMALL_ASTEROID_PINK")); enemyManager.enemyTextures.Add("SMALL_ASTEROID_PURPLE", content.Load<Texture2D>("SMALL_ASTEROID_PURPLE")); enemyManager.enemyTextures.Add("MEDIUM_ASTEROID_RED", content.Load<Texture2D>("MEDIUM_ASTEROID_RED")); enemyManager.enemyTextures.Add("MEDIUM_ASTEROID_BLUE", content.Load<Texture2D>("MEDIUM_ASTEROID_BLUE")); enemyManager.enemyTextures.Add("MEDIUM_ASTEROID_GREEN", content.Load<Texture2D>("MEDIUM_ASTEROID_GREEN")); enemyManager.enemyTextures.Add("MEDIUM_ASTEROID_PINK", content.Load<Texture2D>("MEDIUM_ASTEROID_PINK")); enemyManager.enemyTextures.Add("MEDIUM_ASTEROID_PURPLE", content.Load<Texture2D>("MEDIUM_ASTEROID_PURPLE")); enemyManager.enemyTextures.Add("LARGE_ASTEROID_RED", content.Load<Texture2D>("LARGE_ASTEROID_RED")); enemyManager.enemyTextures.Add("LARGE_ASTEROID_BLUE", content.Load<Texture2D>("LARGE_ASTEROID_BLUE")); enemyManager.enemyTextures.Add("LARGE_ASTEROID_GREEN", content.Load<Texture2D>("LARGE_ASTEROID_GREEN")); enemyManager.enemyTextures.Add("LARGE_ASTEROID_PINK", content.Load<Texture2D>("LARGE_ASTEROID_PINK")); enemyManager.enemyTextures.Add("LARGE_ASTEROID_PURPLE", content.Load<Texture2D>("LARGE_ASTEROID_PURPLE")); enemyManager.enemyTextures.Add("LARGE_SPINNER_BLUE", content.Load<Texture2D>("LARGE_SPINNER_BLUE")); enemyManager.enemyTextures.Add("SMALL_SPINNER_PINK", content.Load<Texture2D>("SMALL_SPINNER_Pink")); enemyManager.enemyTextures.Add("ALIEN", content.Load<Texture2D>("ALIEN")); enemyManager.enemyTextures.Add("ARMORED", content.Load<Texture2D>("ArmoredEnemy")); // Load projectile textures player.projectileTextures.Add("NORMAL_BULLET", content.Load<Texture2D>("Projectile2")); player.projectileTextures.Add("NORMAL_MISSLE", content.Load<Texture2D>("NORMAL_MISSLE")); PowerUpManager.PowerUpTextures.Add("LIFE_UP", content.Load<Texture2D>("powerup_lifeup")); PowerUpManager.PowerUpTextures.Add("WEAPON_UPGRADE", content.Load<Texture2D>("powerup_weaponPower")); // Load sounds SoundManager.soundEffects.Add("player_weapon", content.Load<SoundEffect>("Sounds/fire_laser1")); SoundManager.soundEffects.Add("explosion", content.Load<SoundEffect>("Sounds/sound_explosion")); SoundManager.soundEffects.Add("powerup", content.Load<SoundEffect>("Sounds/sound_powerup")); backgroundLoop = content.Load<Song>("Sounds/particleillusionloop"); MediaPlayer.Play(backgroundLoop); MediaPlayer.IsRepeating = true; PauseOverlay = content.Load<Texture2D>("pause_overlay"); cam = new Camera(); bloom.Settings = BloomSettings.PresetSettings[6]; bloom.Visible = true; }