protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); //load font scoreFont = Content.Load <SpriteFont>(@"fonts\score"); scoreBoldFont = Content.Load <SpriteFont>(@"fonts\scoreBold"); // Load the XACT data audioEngine = new AudioEngine(@"Content\Audio\GameAudio.xgs"); waveBank = new WaveBank(audioEngine, @"Content\Audio\Wave Bank.xwb"); soundBank = new SoundBank(audioEngine, @"Content\Audio\Sound Bank.xsb"); cursorTexture = Content.Load <Texture2D>(@"Images\background"); // Start the soundtrack audio trackCue = soundBank.GetCue("track"); trackCue.Play(); // Play the start sound soundBank.PlayCue("start"); }
private ICue FixCue(SoundBank newSoundBank, ICue cue) { ICue fixedCue = null; if (cue != null) { fixedCue = new CueWrapper(newSoundBank.GetCue(cue.Name)); if (cue.IsPaused) { fixedCue.Play(); fixedCue.Pause(); } if (cue.IsPlaying) { fixedCue.Play(); } } return(fixedCue); }
protected void UpdateInput() { // Get the game pad state. GamePadState currentState = GamePad.GetState(PlayerIndex.One); if (currentState.IsConnected) { ship.Update(currentState); // Set some audio based on whether we're pressing a trigger. if (currentState.Triggers.Right > 0) { if (engineSound == null) { engineSound = soundBank.GetCue("engine_2"); engineSound.Play(); } else if (engineSound.IsPaused) { engineSound.Resume(); } } else { if (engineSound != null && engineSound.IsPlaying) { engineSound.Pause(); } } // In case you get lost, press A to warp back to the center. if (currentState.Buttons.A == ButtonState.Pressed) { ship.Position = Vector3.Zero; ship.Velocity = Vector3.Zero; ship.Rotation = 0.0f; // Make a sound when we warp. soundBank.PlayCue("hyperspace_activate"); } } }
/******************************************************************************************* * Main Load * *****************************************************************************************/ protected override void LoadContent() { // load font spriteBatch = new SpriteBatch(GraphicsDevice); statsFont = Content.Load <SpriteFont>("Fonts/StatsFont"); instructionsFont = Content.Load <SpriteFont>("Fonts/InstructionsFont"); // load sounds and play initial sound audioEngine = new AudioEngine("Content/Audio/GameAudio.xgs"); waveBank = new WaveBank(audioEngine, "Content/Audio/Wave Bank.xwb"); soundBank = new SoundBank(audioEngine, "Content/Audio/Sound Bank.xsb"); trackCue = soundBank.GetCue("Tracks"); trackCue.Play(); // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); // load spaceship spaceship.LoadContent(Content, "Models/spaceship"); CreateObstacles1(); CreateObstacles2(); CreateObstacles3(); CreateObstacles4(); CreateObstacles5(); CreateObstacles6(); CreateAstronauts(); CreateStars(); // load ground ground.LoadContent(Content, "Models/ground"); // load lifebar lifebar = Content.Load <Texture2D>("Textures/lifebar5"); // load uhd uhd = Content.Load <Texture2D>("Textures/uhd"); // load logo logo = Content.Load <Texture2D>("Textures/logo"); }
/// <summary> /// Updates the AudioSystem. /// </summary> public void Update() { if (!isInitialized) { return; } if (bgMusic != null && bgMusic.IsStopped) { bgMusic = soundBank.GetCue(bgMusic.Name); bgMusic.Play(); activeCues.Add(bgMusic); } // Remove cues from the activeCues list which have stopped. for (int i = activeCues.Count - 1; i >= 0; i--) { if (activeCues[i].IsStopped) { activeCues.RemoveAt(i); } } // Update 3D cues. for (int i = activeCue3Ds.Count - 1; i >= 0; i--) { Cue3D cue3D = activeCue3Ds[i]; if (cue3D.Cues[0].IsStopped) { // If the cue has stopped playing, dispose it. cue3D.DisposeCues(); // Store the Cue3D instance for future reuse. inactiveCue3Ds.Enqueue(cue3D); // Remove it from the active list. activeCue3Ds.RemoveAt(i); } else { // If the cue is still playing, update its 3D settings. Update3DSettings(cue3D); } } // Update the audio engine. audioEngine.Update(); }
public static void Play(string musicCueName) { while (!Wave.IsPrepared) { Audio.Sound.Update(); } if (string.Compare(_musicStr, musicCueName, true, CultureInfo.InvariantCulture) != 0) { _musicStr = musicCueName; if (_musicCue != null) { _musicCue.Dispose(); } _musicCue = Sound.GetCue(_musicStr); _musicCue.Play(); } }
/// <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() { Sonya.Initialize(graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight); SubZero.Initialize(graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight); SonyaGreenBar.health(new Vector2(graphics.PreferredBackBufferWidth / 45, graphics.PreferredBackBufferHeight / 30), SonyaHealth, Color.LimeGreen); SonyaRedBar.health(new Vector2(graphics.PreferredBackBufferWidth / 45, graphics.PreferredBackBufferHeight / 30), SonyaHealth, Color.Red); SubZGreenBar.health(new Vector2(graphics.PreferredBackBufferWidth - 580, graphics.PreferredBackBufferHeight / 30), SonyaHealth, Color.LimeGreen); SubZRedBar.health(new Vector2(graphics.PreferredBackBufferWidth - 580, graphics.PreferredBackBufferHeight / 30), SonyaHealth, Color.Red); audioEngine = new AudioEngine("Content\\game music.xgs"); waveBank = new WaveBank(audioEngine, "Content\\Wave Bank.xwb"); soundBank = new SoundBank(audioEngine, "Content\\Sound Bank.xsb"); musicCue = soundBank.GetCue("fighting backgorund music"); musicCue.Play(); base.Initialize(); this.IsMouseVisible = false; }
public void Play() { if (cue.IsPaused) { cue.Resume(); return; } if (cue.IsPlaying) { return; } if (cue.IsStopped) { cue = sb.GetCue(cueName); Volume = vol; } cue.Play(); }
/// <summary> /// Plays a sound based on location in a 3D world. /// </summary> /// <param name="_soundName">Name of the sound cue.</param> /// <param name="_playerPosition">Position of the player.</param> /// <param name="_position">Position of the sound -- basically, the position of the /// object which emits sound.</param> /// <param name="_velocity">Speed/direction in which the sound is moving.</param> /// <param name="_loop">True to loop the sound over and over; false otherwise.</param> public SoundCue Play3DSound(String _soundName, Vector3 _playerPosition, Vector3 _position, Vector3 _velocity, bool _loop) { SoundCue newCue = new SoundCue(soundBank.GetCue(_soundName), _soundName); newCue.Loop = _loop; listener.Position = _playerPosition; newCue.Emitter.Velocity = _velocity; newCue.Emitter.Position = _position; newCue.Apply3DEffects(listener); activeSounds.Add(newCue); if (!muted) { newCue.Play(); } return(newCue); }
public Cue Play3DCue(string cueName, Vector2 position) { Cue3D cue3D; if (mCuePool.Count > 0) { cue3D = mCuePool.Pop(); } else { cue3D = new Cue3D(); } cue3D.Cue = SoundBank.GetCue(cueName); cue3D.Position = new Vector3(position.X, position.Y, 0); Apply3D(cue3D); cue3D.Cue.Play(); mActiveCues.Add(cue3D); return(cue3D.Cue); }
/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { // Allows the game to exit if (Keyboard.GetState().IsKeyDown(Keys.Escape) == true || GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) { this.Exit(); } if (streamingWaveBank.IsPrepared == true && cue == null) { cue = soundBank.GetCue("song1"); } if (cue != null && cue.IsPlaying == false && cue.IsStopped == false) { cue.Play(); } engine.Update(); base.Update(gameTime); }
/// <summary> /// Plays an audio sample. /// </summary> /// <param name="soundCue">The sound cue.</param> public void PlayCue(string soundCue) { if (_audioEngine == null) { return; } Cue cue = null; try { cue = _soundBank.GetCue(soundCue); } catch { throw; } if (cue != null) { cue.Play(); } }
public void SoundBankCtor() { Assert.Throws <ArgumentNullException>(() => new SoundBank(null, null)); Assert.Throws <ArgumentNullException>(() => new SoundBank(_audioEngine, null)); Assert.Throws <ArgumentNullException>(() => new SoundBank(_audioEngine, "")); //Assert.Throws<DirectoryNotFoundException>(() => new SoundBank(_audioEngine, @"This\Does\Not\Exist.xsb")); Assert.Throws <FileNotFoundException>(() => new SoundBank(_audioEngine, @"Assets\Audio\Win\NotTheFile.xsb")); var soundBank = new SoundBank(_audioEngine, @"Assets\Audio\Win\Tests.xsb"); Assert.False(soundBank.IsInUse); Assert.False(soundBank.IsDisposed); var cue = soundBank.GetCue("blast_mono"); Assert.True(soundBank.IsInUse); cue.Dispose(); //Assert.False(soundBank.IsInUse); // MonoGame Fail soundBank.Dispose(); Assert.True(soundBank.IsDisposed); Assert.False(soundBank.IsInUse); }
/// <summary> /// Play this sound now. /// </summary> public void Play() { // Dispose cue because can only played once // see: http://forums.xna.com/thread/11094.aspx if (!cue.IsDisposed) { cue.Dispose(); } cue = bank.GetCue(Name); switch (Type) { case SoundType.Effect: al.Position = box.ListenerPosition; emitter.Position = this.GlobalPosition; if ((al != null) && (emitter != null)) { try { cue.Apply3D(al, emitter); } catch (System.Exception) { // Catch XNA Sound error. One member of the development team // get errors if multiple sound device are attached. } } break; } // Wait for stopping cue. while (cue.IsStopping) { } if (!cue.IsPlaying) { cue.Play(); } }
private static void PlaySound(string cueName, Vector2 sourceTilePos) { try { SoundBank soundBank = ModEntry.GetHelper().Reflection.GetField <SoundBank>(Game1.soundBank as SoundBankWrapper, "soundBank").GetValue(); Cue cue = soundBank.GetCue(cueName); AudioListener listener = new AudioListener { Position = new Vector3(Game1.player.Position, 0) }; AudioEmitter emitter = new AudioEmitter { Position = new Vector3(sourceTilePos * Game1.tileSize, 0) }; cue.Apply3D(listener, emitter); cue.Play(); } catch (System.Exception e) { ModEntry.Log("Error while playing sound: " + e.Message); } }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); // TODO: use this.Content to load your game content here //Sprites bkgrnd = Content.Load <Texture2D>("Sprites/GameBackground"); splash = Content.Load <Texture2D>("Sprites/splash"); wepen = Content.Load <Texture2D>("Sprites/Cannon2"); ene1 = Content.Load <Texture2D>("Sprites/zombie"); ene2 = Content.Load <Texture2D>("Sprites/zombieKnight"); cb = Content.Load <Texture2D>("Sprites/cannonballs"); score = Content.Load <SpriteFont>("score"); m.img = Content.Load <Texture2D>("Sprites/goodbad"); //Sounds audioEngine = new AudioEngine(@"Content\Sounds.xgs"); waveBank = new WaveBank(audioEngine, @"Content\Wave Bank.xwb"); soundBank = new SoundBank(audioEngine, @"Content\Sound Bank.xsb"); track = soundBank.GetCue("ThemeOne"); track.Play(); }
public override void Update(GameTime tempo) { base.Update(tempo); MouseState mouse = Mouse.GetState(); KeyboardState teclado = Keyboard.GetState(); MediaPlayer.Volume = (rcMedidor.X / (rcbarra.X + rcbarra.Width)); if (MediaPlayer.State == MediaState.Stopped && tocar) { engineSound = soundBank3.GetCue("silly_fun"); engineSound.Play(); tocar = false; } if (!pauseFlag) { if (repetir) { Player1 = soundBank.GetCue("logo_music_36"); engineSound = soundBank3.GetCue("silly_fun"); Player1.Play(); MediaPlayer.Play(Inicio); tocar = true; repetir = false; } if (parent.IsActive) { if (bepe) { soundBank.PlayCue("magic_chime_07"); bepe = false; } } if (stateEntered) { if (engineSound.IsStopped && tocar == false) { engineSound = soundBank3.GetCue("silly_fun"); engineSound.Play(); } rcSeta = new Rectangle((int)menus[escolha].X, (int)menus[escolha].Y, seta.Width, seta.Height); if (Sair) { Alpha = 0.3f; if (ColisaoMouseOver(mouse, OK[OKin], rcOK)) { OKin = 1; } else { OKin = 0; } if (ColisaoMouseOver(mouse, Cancelar[CancIN], rcCancelar)) { CancIN = 1; } else { CancIN = 0; } if (mouse.LeftButton == ButtonState.Pressed) { if (ColisaoMouseOver(mouse, OK[OKin], rcOK)) { parent.Exit(); } if (ColisaoMouseOver(mouse, Cancelar[CancIN], rcCancelar)) { Alpha = 1; Sair = false; } } } if (Historinha) { SelecaoDeEpisodio(); } if (Creditos) { /* * CreditosMENU(); * if (ColisaoMouseOver(mouse, Voltar[VoltarIndice], vVoltar)) * { * VoltarIndice = 1; * } * else { VoltarIndice = 0; } * if (mouse.LeftButton == ButtonState.Pressed) * { * if (ColisaoMouseOver(mouse, Voltar[VoltarIndice], vVoltar)) * { * Creditos = false; * * } * }*/ } if (Config) { ConfiguracoesMENU(); if (ColisaoMouseOver(mouse, Voltar[VoltarIndice], vVoltar)) { VoltarIndice = 1; } else { VoltarIndice = 0; } if (mouse.LeftButton == ButtonState.Pressed) { if (ColisaoMouseOver(mouse, Voltar[VoltarIndice], vVoltar)) { Config = false; } if (ColisaoMouseOver(mouse, Medidor, rcMedidor)) { rcMedidor.X = mouse.X - rcMedidor.Width / 2; if (mouse.X > rcbarra.X + rcbarra.Width + 1) { rcMedidor.X = rcbarra.X + rcbarra.Width; } if (mouse.X < rcbarra.X) { rcMedidor.X = rcbarra.X; } } } } if (!Historinha && !BateBola && !Caderno && !Config && !Creditos && !Sair) { if (parent.IsActive) { #region Comandos Teclado if ((teclado.IsKeyDown(Keys.Right)) && (lastKey != Keys.Right)) { escolha += escolha == 4 ? 0 : 1; } if (teclado.IsKeyDown(Keys.Left) && lastKey != Keys.Left) { escolha -= escolha == 0 ? 0 : 1; } if (PressionarTecla(Keys.Enter, teclado)) { switch (escolha) { case 0: Historinha = true; break; case 1: BateBola = true; break; case 2: Caderno = true; break; case 3: Creditos = true; break; case 4: Sair = true; break; } } Keys[] ks = teclado.GetPressedKeys(); if (ks.Length == 0) { lastKey = Keys.A; } else { lastKey = ks[0]; } #endregion #region Comandos Mouse if (!Historinha && !Creditos) { #region Over if (ColisaoMouseOver(mouse, menu1[mn1], rcmenu1)) { escolha = 0; mn1 = 1; } else { mn1 = 0; } if (ColisaoMouseOver(mouse, menu2[mn2], rcmenu2)) { escolha = 1; mn2 = 1; } else { mn2 = 0; } if (ColisaoMouseOver(mouse, menu3[mn3], rcmenu3)) { escolha = 2; mn3 = 1; } else { mn3 = 0; } if (ColisaoMouseOver(mouse, menu5[mn5], rcmenu5)) { escolha = 3; mn5 = 1; } else { mn5 = 0; } if (ColisaoMouseOver(mouse, menu6[mn6], rcmenu6)) { escolha = 4; mn6 = 1; } else { mn6 = 0; } #endregion #region Click if (mouse.LeftButton == ButtonState.Pressed) { bepe = true; if (ColisaoMouseOver(mouse, menu1[mn1], rcmenu1)) { Historinha = true; } if (ColisaoMouseOver(mouse, menu2[mn2], rcmenu2)) { BateBola = true; } if (ColisaoMouseOver(mouse, menu3[mn3], rcmenu3)) { Caderno = true; } if (ColisaoMouseOver(mouse, menu5[mn5], rcmenu5)) { Creditos = true; } if (ColisaoMouseOver(mouse, menu6[mn6], rcmenu6)) { Sair = true; } } #endregion } if (Creditos) { engineSound.Stop(AudioStopOptions.AsAuthored); MediaPlayer.Stop(); Creditos = false; parent.EnterState((int)StatesIdList.CREDITS); } if (Caderno) { Caderno = false; parent.EnterState((int)StatesIdList.OPTIONS); } if (Historinha) { } else if (BateBola) { engineSound.Stop(AudioStopOptions.AsAuthored); MediaPlayer.Stop(); BateBola = false; parent.EnterState((int)StatesIdList.CHAR_SELECTION); } #endregion } } } } }
private void playFenceHit() { Cue hit_Cue = soundBank.GetCue("Fence_Hit_Cue"); hit_Cue.Play(); }
public static Cue GetCue(String cue) { return(sound.GetCue(cue)); }
private PooledCue(SoundBank sb, string sound) { TheCue = sb.GetCue(sound); }
public void SoundPlay(SoundEnum sound) { switch (sound) { case SoundEnum.Click: Sounds[SoundEnum.Click] = _soundBank.GetCue("RICOCHET"); Sounds[SoundEnum.Click].Play(); break; case SoundEnum.Desert: Sounds[SoundEnum.Desert] = _soundBank.GetCue("wind03"); Sounds[SoundEnum.Desert].Play(); break; case SoundEnum.DeadSpider: Sounds[SoundEnum.Desert] = _soundBank.GetCue("guts04a"); Sounds[SoundEnum.Desert].Play(); break; case SoundEnum.Grass: Sounds[SoundEnum.Grass] = _soundBank.GetCue("cricket00"); Sounds[SoundEnum.Grass].Play(); break; case SoundEnum.Gunshot: Sounds[SoundEnum.Gunshot] = _soundBank.GetCue("GUNSHOT"); Sounds[SoundEnum.Gunshot].Play(); break; case SoundEnum.Heartbeat: Sounds[SoundEnum.Gunshot] = _soundBank.GetCue("heartbeat"); Sounds[SoundEnum.Gunshot].Play(); break; case SoundEnum.Laser: Sounds[SoundEnum.Gunshot] = _soundBank.GetCue("LASER"); Sounds[SoundEnum.Laser].Play(); break; case SoundEnum.Lava: Sounds[SoundEnum.Lava] = _soundBank.GetCue("lava_burn1"); Sounds[SoundEnum.Lava].Play(); break; case SoundEnum.Lava2: Sounds[SoundEnum.Lava2] = _soundBank.GetCue("lava"); Sounds[SoundEnum.Lava2].Play(); break; case SoundEnum.MainTheme: Sounds[SoundEnum.MainTheme] = _soundBank.GetCue("STARWARS"); Sounds[SoundEnum.MainTheme].Play(); break; case SoundEnum.Sand: Sounds[SoundEnum.Sand] = _soundBank.GetCue("wind03"); Sounds[SoundEnum.Sand].Play(); break; case SoundEnum.Snow: Sounds[SoundEnum.Snow] = _soundBank.GetCue("wind01b"); Sounds[SoundEnum.Snow].Play(); break; case SoundEnum.Spider: Sounds[SoundEnum.Spider] = _soundBank.GetCue("angry"); Sounds[SoundEnum.Spider].Play(); break; default: Sounds[SoundEnum.MainTheme] = _soundBank.GetCue("STARWARS"); Sounds[SoundEnum.MainTheme].Play(); break; } //sounds[Sound].Play(); }
public ICue GetCue(string name) { return(new CueWrapper(soundBank.GetCue(name))); }
private void PlayBGCue(int cueNr) { currentCue = soundBank.GetCue(bgCueNames[cueNr]); currentCue.Play(); }
/// <summary> /// Retrieve a cue by name. /// </summary> /// <param name="cueName">The name of the cue requested.</param> /// <returns>The cue corresponding to the name provided.</returns> public Cue GetCue(string cueName) { return(sounds.GetCue(cueName)); }
/// <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() { MBox = new Texture2D[1]; MBox[0] = Content.Load <Texture2D>("hint"); BlackBack = Content.Load <Texture2D>("BlackFront"); Paused = true; SetWorld = new List <LoadLevel>(); SetWorld.Add(new LoadLevel()); SetWorld[0].level(5); Levels = new List <Texture2D>(); SetBlocks(); Background = new List <Texture2D>(); SetBG(); Cameratest = new Camera(graphics, new Vector2(0, 400)); Rnd = new Random(); // Addlevel(); Collision = false; Player = new Sprite(10, 6, 1); Player.Standing = Content.Load <Texture2D>("Stand"); //Sets the images Player.Moving[0] = Content.Load <Texture2D>("Run\\Run2"); Player.Moving[1] = Content.Load <Texture2D>("Run\\Run3"); Player.Moving[2] = Content.Load <Texture2D>("Run\\Run4");; Player.Moving[3] = Content.Load <Texture2D>("Run\\Run5"); Player.Moving[4] = Content.Load <Texture2D>("Run\\Run6"); Player.Moving[5] = Content.Load <Texture2D>("Run\\Run7"); Player.Moving[6] = Content.Load <Texture2D>("Run\\Run8"); Player.Moving[7] = Content.Load <Texture2D>("Run\\Run9"); Player.Moving[8] = Content.Load <Texture2D>("Run\\Run10"); Player.Moving[9] = Content.Load <Texture2D>("Run\\Run10"); Player.Jumping[5] = Content.Load <Texture2D>("Jump\\jump2"); Player.Jumping[4] = Content.Load <Texture2D>("Jump\\jump3"); Player.Jumping[3] = Content.Load <Texture2D>("Jump\\jump4"); Player.Jumping[2] = Content.Load <Texture2D>("Jump\\jump5"); Player.Jumping[1] = Content.Load <Texture2D>("Jump\\jump6"); Player.Jumping[0] = Content.Load <Texture2D>("Jump\\jump7"); Player.FacingRight = true; Player.SpritePosition = new Vector2(-200, 0); Player.InAir = false; Player.update(); Pirates = new List <Sprite>(); OldState = Keyboard.GetState(); Force = new Vector2(0, 1); Up = false; Right = false; Down = false; Left = false; Jump = false; ReadyToJump = false; Winner = false; SplashSound = false; engine = new AudioEngine("Content/Music.xgs"); waveBank = new WaveBank(engine, "Content/Wave Bank.xwb"); soundBank = new SoundBank(engine, "Content/Sound Bank.xsb"); Listen = new AudioListener(); Emiter = new AudioEmitter(); //listen and emmiter data Listen.Position = new Vector3(this.Window.ClientBounds.Width / 2, this.Window.ClientBounds.Height / 2, 0.0f); Emiter.Position = new Vector3(this.Window.ClientBounds.Width / 2, this.Window.ClientBounds.Height / 2, 0.0f); generalCategory = engine.GetCategory("Default"); //Song Song = soundBank.GetCue("Ditty"); //Player Sounds JumpSFX = new Cue[4]; WinSFX = new Cue[2]; JumpSFX[0] = soundBank.GetCue("jump1"); JumpSFX[1] = soundBank.GetCue("jump2"); JumpSFX[2] = soundBank.GetCue("jump3"); JumpSFX[3] = soundBank.GetCue("jump4"); WinSFX[0] = soundBank.GetCue("success1"); WinSFX[1] = soundBank.GetCue("success2"); SplashSFX = soundBank.GetCue("sploosh"); DeathSFX = soundBank.GetCue("death"); LandSFX = soundBank.GetCue("land"); //Pirate Sounds PirateYarr = new Cue[2]; PirateYarr[0] = soundBank.GetCue("PirateYarr1"); PirateYarr[1] = soundBank.GetCue("PirateYarr2"); PirateDeath = soundBank.GetCue("Piratedeath"); PirateSwing = soundBank.GetCue("Pirateswing"); base.Initialize(); }
public static Cue getEngineHum() { return(effectSound.GetCue("Hum")); }
public void Initailise() { engine = new AudioEngine("Content\\Materia TD.xgs"); soundBank = new SoundBank(engine, "Content\\Sound Bank.xsb"); waveBank = new WaveBank(engine, "Content\\Wave Bank.xwb"); soundLibrary["MainMenu"] = soundBank.GetCue("MainMenu"); soundLibrary["SilverSageIntro"] = soundBank.GetCue("SilverSageIntro"); soundLibrary["PauseScreen"] = soundBank.GetCue("PauseScreen"); soundLibrary["MenuButtonClick"] = soundBank.GetCue("MenuButtonClick"); soundLibrary["TowersFiring"] = soundBank.GetCue("TowersFiring"); soundLibrary["EnemiesDyingNew"] = soundBank.GetCue("EnemiesDyingNew"); soundLibrary["OnTowerSell"] = soundBank.GetCue("OnTowerSell"); soundLibrary["OnTowerCreation"] = soundBank.GetCue("OnTowerCreation"); soundLibrary["WaitingForWaves"] = soundBank.GetCue("WaitingForWaves"); soundLibrary["EarthEnemies"] = soundBank.GetCue("EarthEnemies"); soundLibrary["WaterEnemies"] = soundBank.GetCue("WaterEnemies"); soundLibrary["WindEnemies"] = soundBank.GetCue("WindEnemies"); soundLibrary["FireEnemies"] = soundBank.GetCue("FireEnemies"); soundLibrary["LightningEnemies"] = soundBank.GetCue("LightningEnemies"); soundLibrary["DarknessEnemies"] = soundBank.GetCue("DarknessEnemies"); soundLibrary["DarknessAlly"] = soundBank.GetCue("DarknessAlly"); soundLibrary["CannotBuildTower"] = soundBank.GetCue("CannotBuildTower"); soundLibrary["FoolishDecision"] = soundBank.GetCue("FoolishDecision"); soundLibrary["SoYouThink"] = soundBank.GetCue("SoYouThink"); soundLibrary["EarthTower"] = soundBank.GetCue("EarthTower"); soundLibrary["DarkTower"] = soundBank.GetCue("DarkTower"); soundLibrary["FireTower"] = soundBank.GetCue("FireTower"); soundLibrary["WaterTower"] = soundBank.GetCue("WaterTower"); soundLibrary["WindTower"] = soundBank.GetCue("WindTower"); soundLibrary["LightTower"] = soundBank.GetCue("LightTower"); soundLibrary["TowersUpgrade"] = soundBank.GetCue("TowersUpgrade"); soundLibrary["Marching"] = soundBank.GetCue("Marching"); soundLibrary["Evil_laugh"] = soundBank.GetCue("Evil_laugh"); }
public ICue GetCue(string name) { return(new XactCue(_soundBank.GetCue(name))); }
protected void UpdateInput() { //Obtener el estado del keyboard KeyboardState currentKeyState = Keyboard.GetState(); // Get the game pad state. GamePadState currentState = GamePad.GetState(PlayerIndex.One); //if (currentState.IsConnected) //{ ship.Update2(currentKeyState); // Set some audio based on whether we're pressing a trigger. if (currentState.Triggers.Right > 0) { if (engineSound == null) { engineSound = soundBank.GetCue("engine_2"); engineSound.Play(); } else if (engineSound.IsPaused) { engineSound.Resume(); } } else { if (engineSound != null && engineSound.IsPlaying) { engineSound.Pause(); } } // In case you get lost, press B to warp back to the center. if (currentState.Buttons.B == ButtonState.Pressed && lastState.Buttons.B == ButtonState.Released) { ship.Position = Vector3.Zero; ship.Velocity = Vector3.Zero; ship.Rotation = 0.0f; ship.isActive = true; score -= GameConstants.WarpPenalty; // Make a sound when we warp. soundBank.PlayCue("hyperspace_activate"); } //} //are we shooting? if (ship.isActive && currentState.Buttons.A == ButtonState.Pressed && lastState.Buttons.A == ButtonState.Released) { //add another bullet. Find an inactive bullet slot and use it //if all bullets slots are used, ignore the user input for (int i = 0; i < GameConstants.NumBullets; i++) { if (!bulletList[i].isActive) { bulletList[i].direction = ship.RotationMatrix.Forward; bulletList[i].speed = GameConstants.BulletSpeedAdjustment; bulletList[i].position = ship.Position + (200 * bulletList[i].direction); bulletList[i].isActive = true; score -= GameConstants.ShotPenalty; soundBank.PlayCue("tx0_fire1"); break; //exit the loop } } } lastState = currentState; }
public void LoadSounds() { _engine = new AudioEngine("Content\\Sounds\\BackSounds.xgs"); _soundBank = new SoundBank(_engine, "Content\\Sounds\\Sound Bank.xsb"); _waveBank = new WaveBank(_engine, "Content\\Sounds\\Wave Bank.xwb"); _engine.GetCategory("Music"); Sounds.Add(SoundEnum.Click, _soundBank.GetCue("RICOCHET")); Sounds.Add(SoundEnum.Desert, _soundBank.GetCue("wind03")); Sounds.Add(SoundEnum.DeadSpider, _soundBank.GetCue("guts04a")); Sounds.Add(SoundEnum.Grass, _soundBank.GetCue("cricket00")); Sounds.Add(SoundEnum.Gunshot, _soundBank.GetCue("GUNSHOT")); Sounds.Add(SoundEnum.Heartbeat, _soundBank.GetCue("heartbeat")); Sounds.Add(SoundEnum.Laser, _soundBank.GetCue("LASER")); Sounds.Add(SoundEnum.Lava, _soundBank.GetCue("lava_burn1")); Sounds.Add(SoundEnum.Lava2, _soundBank.GetCue("lava")); Sounds.Add(SoundEnum.MainTheme, _soundBank.GetCue("STARWARS")); Sounds.Add(SoundEnum.Sand, _soundBank.GetCue("wind03")); Sounds.Add(SoundEnum.Snow, _soundBank.GetCue("wind01b")); Sounds.Add(SoundEnum.Spider, _soundBank.GetCue("angry")); }