public void Attack() { this.target = null; SoundEffectInstance miniGun = MediaHandler.mGun.CreateInstance(); SoundEffectInstance obelRay = MediaHandler.ObeliskBeamSound.CreateInstance(); SoundEffectInstance sniperGun = MediaHandler.sGun.CreateInstance(); miniGun.Volume = 0.45f; sniperGun.Volume = 0.5f; obelRay.Volume = 0.75f; foreach (Enemy enemy in Constants.EnemyList) { float inRange = Vector2.Distance(this.Center, enemy.Center); if (inRange <= this.range) { isHit = true; if (this is Pillbox && this.buildingState != BuildingState.UpgradedDmg) { miniGun.Play(); ExplosionManager.CreateExplosions(enemy.Position); } if (this is Pillbox && this.buildingState == BuildingState.UpgradedDmg) { sniperGun.Play(); } if (this is Obelisk) { obelRay.Play(); } enemy.Health -= this.damage; this.shootTimer = this.timerValue; break; } } }
protected override void LoadContent() { graphics.PreferredBackBufferWidth = Constants.ScreenWidth; graphics.PreferredBackBufferHeight = Constants.ScreenHeight; graphics.ApplyChanges(); TextureManager.LoadContent(Content); MediaHandler.LoadContent(Content); TowerManager = new BuildingManager(GraphicsDevice); LevelManager = new LevelManager(GraphicsDevice); player = new Player(TowerManager, GraphicsDevice); enemyHandler = new EnemyManager(); explosionManager = new ExplosionManager(); menuManager = new MenuManager(GraphicsDevice); spriteBatch = new SpriteBatch(GraphicsDevice); }