public override void execute(float deltaTime) { IrrKlang.ISound music = null; //MoveGrid grid.moveGrid(); //Play Sound if (count == 0) { music = soundEngine.Play2D("fastinvader4.wav"); count++; } else if (count == 1) { music = soundEngine.Play2D("fastinvader3.wav"); count++; } else if (count == 2) { music = soundEngine.Play2D("fastinvader2.wav"); count++; } else if (count == 3) { music = soundEngine.Play2D("fastinvader1.wav"); count = 0; } music.Volume = 0.2f; TimerManager.sortedAdd(TimerEvent.TimerEventName.SpriteAnimation, this, Unit.AlienGridMoveEventTime); }
//----------------------------------------------------------------------------- // Game::LoadContent() // Allows you to load all content needed for your engine, // such as objects, graphics, etc. //----------------------------------------------------------------------------- public override void LoadContent() { //--------------------------------------------------------------------------------------------------------- // Audio //--------------------------------------------------------------------------------------------------------- // Create the Audio Engine AudioEngine = new IrrKlang.ISoundEngine(); // Play a sound file music = AudioEngine.Play2D("theme.wav", true); music.Volume = 0.2f; // Resident loads srcShoot = AudioEngine.AddSoundSourceFromFile("shoot.wav"); sndShoot = AudioEngine.Play2D(srcShoot, false, false, false); sndShoot.Stop(); //--------------------------------------------------------------------------------------------------------- // Setup Font //--------------------------------------------------------------------------------------------------------- // Font - texture pFont = new Azul.Texture("consolas20pt.tga"); Debug.Assert(pFont != null); GlyphMan.AddXml("Consolas20pt.xml", pFont); //--------------------------------------------------------------------------------------------------------- // Load the Textures //--------------------------------------------------------------------------------------------------------- // Red bird texture pText = new Azul.Texture("unsorted.tga"); Debug.Assert(pText != null); //--------------------------------------------------------------------------------------------------------- // Create Sprites //--------------------------------------------------------------------------------------------------------- pRedBird = new Azul.Sprite(pText, new Azul.Rect(903.0f, 797.0f, 46.0f, 46.0f), new Azul.Rect(300.0f, 100.0f, 30.0f, 30.0f)); Debug.Assert(pRedBird != null); //--------------------------------------------------------------------------------------------------------- // Demo variables //--------------------------------------------------------------------------------------------------------- stats = new GameStats(); }
public override void Notify() { Debug.WriteLine("SndObserver: {0} {1}", this.pSubject.pObjA, this.pSubject.pObjB); pSndEngine.SoundVolume = 0.2f; IrrKlang.ISound pSnd = pSndEngine.Play2D("fastinvader1.wav"); }
public override void Notify() { //Debug.WriteLine(" Sound_Observer: {0} {1}", this.pSubject.pObjA, this.pSubject.pObjB); pSndEngine.SoundVolume = 0.2f; IrrKlang.ISound pSnd = pSndEngine.Play2D(this.pSndName); }
//---------------------------------------------------------------------------------- // Play It //---------------------------------------------------------------------------------- public void Play(float volInput = 0.2f) { IrrKlang.ISound music = engine.Play2D(this.source, false, false, false); if (music != null) { music.Volume = volInput; } }
public override void execute(float deltaTime) { IrrKlang.ISoundEngine soundEngine = FactoryManager.getSoundEngine(); if (ufo.launch) { IrrKlang.ISound music = soundEngine.Play2D("ufo_lowpitch.wav"); music.Volume = 0.2f; TimerManager.sortedAdd(TimerEvent.TimerEventName.UFOPlaySound, this, 2.2f); } }
public override void Execute(float deltaTime) { ActivateUFO(); IrrKlang.ISoundEngine pSndEngine = GameMan.GetGame().GetSndEngine(); pSndEngine.Play2D("ufo_lowpitch.wav"); TimerMan.Add(TimeEvent.Name.SendUFO, this, deltaTime); TimerMan.Add(TimeEvent.Name.UFOBomb, new UFOBombDrop(this.pUFO), 1.0f); TimerMan.Add(TimeEvent.Name.PlaySound, new UFOSound(), 1.5f); }
// Author: Brandon Wegner public override void LoadContent() { AudioEngine = new IrrKlang.ISoundEngine(); music = AudioEngine.Play2D("theme.wav", true); music.Volume = 0.2f; srcShoot = AudioEngine.AddSoundSourceFromFile("shoot.wav"); sndShoot = AudioEngine.Play2D(srcShoot, false, false, false); sndShoot.Stop(); pFont = new Azul.Texture("consolas20pt.tga"); GlyphMan.AddXml("Consolas20pt.xml", pFont); pText = new Azul.Texture("unsorted.tga"); pRedBird = new Azul.Sprite(pText, new Azul.Rect(903.0f, 797.0f, 46.0f, 46.0f), new Azul.Rect(300.0f, 100.0f, 30.0f, 30.0f)); }
//this is hopefully going to sound of every 1 second not sure if thats what its supposed to do public override void Execute(float deltaTime) { SpaceInvaders pGame = GameMan.GetGame(); IrrKlang.ISoundEngine pSndEngine = pGame.GetSndEngine(); pSndEngine.SoundVolume = 0.1f; pSndEngine.Play2D("ufo_lowpitch.wav"); TimerMan.Add(TimeEvent.Name.PlaySound, this, deltaTime); }
void timer_Elapsed(object sender, ElapsedEventArgs e) { string prefix = @"./Content/SampleBMS/"; List <string> temp = 시간들[timeflag]; for (int i = 0; i < temp.Count; i++) { Debug.WriteLine("B: T={0}, i={1}, C={2}", timeflag, i, temp.Count); 재생중음원 = 사운드엔진.Play2D(prefix + temp[i], false); Debug.WriteLine("A: T={0}, i={1}, C={2}", timeflag, i, temp.Count); } timeflag++; }
public override void ShootMissile(Ship pShip) { Missile pMissile = ShipMan.ActivateMissile(); pSndEngine.SoundVolume = 0.2f; pSndEngine.Play2D("shoot.wav"); pMissile.SetPos(pShip.x, pShip.y + 15); pMissile.SetActive(true); //then sets you to missile flying state //aka u cant shoot a missile this.Handle(pShip); }
public override void Execute(float deltaTime) { AlienGroup pGrid = GetComposite(); pGrid.MoveAcross(); //sound 1 at 500+ if (pGrid.y >= 500) { pSndEngine.SoundVolume = 0.2f; pSndEngine.Play2D("fastinvader1.wav"); } //sound 2 at 499 - 400 else if (pGrid.y < 500 && pGrid.y >= 400) { pSndEngine.SoundVolume = 0.2f; pSndEngine.Play2D("fastinvader2.wav"); } //sound 3 at 399 - 300 else if (pGrid.y < 400 && pGrid.y >= 300) { pSndEngine.SoundVolume = 0.2f; pSndEngine.Play2D("fastinvader3.wav"); } //sound 4 at 299-0 else if (pGrid.y < 300) { pSndEngine.SoundVolume = 0.2f; pSndEngine.Play2D("fastinvader4.wav"); } TimerMan.Add(TimeEvent.Name.MoveGrid, this, deltaTime); }
public override void shoot(CannonShip ship) { // Debug.WriteLine("ShipReadyState shoot"); StraightMissile missile = ShipManager.activateMissile(); Debug.Assert(missile != null); missile.x = ship.x; missile.y = ship.y; missile.launchMissile(); IrrKlang.ISoundEngine sndEngine = FactoryManager.getSoundEngine(); IrrKlang.ISound music = sndEngine.Play2D("shoot.wav"); music.Volume = 0.2f; this.handle(ship); }
public override void Execute(float deltaTime) { Composite pFlyingSaucerRoot = GameStateManager.GetGame().GetStateCompositeManager().Find(Composite.CompositeName.FlyingSaucerRoot); IrrKlang.ISoundEngine pSoundEngine = SoundEngineManager.GetSoundEngine(); // If flying saucer is active if (pFlyingSaucerRoot.GetFirstChild() != null) { // Check to see if sound is currently playing if (!pSoundEngine.IsCurrentlyPlaying("ufo_lowpitch.wav")) { IrrKlang.ISound pSnd = pSoundEngine.Play2D("ufo_lowpitch.wav"); } base.Execute(deltaTime); } }
// plays filename selected in edit box void playSelectedFile() { // stop currently playing sound if (currentlyPlayingSound != null) { currentlyPlayingSound.Stop(); } // start new sound currentlyPlayingSound = irrKlangEngine.Play2D(filenameTextBox.Text, true); // update controls to display the playing file UpdatePauseButtonText(); volumeTrackBar.Value = 100; }
public override void Execute(float deltaTime, TimeEvent.Name name) { //if (Component.right > 896 || Component.left < 0.0f) //{ // Component.speed *= -1.0f; // grid.MoveDown(); //} //Component.right += Component.speed; //Component.left += Component.speed; grid.MoveGrid(); IrrKlang.ISoundEngine pSndEngine = SpaceInvaders.GetInstance().sndEngine; pSndEngine.SoundVolume = 0.2f; if (counting % 4 == 0) { pSndEngine.Play2D("fastinvader1.wav"); } else if (counting % 4 == 1) { pSndEngine.Play2D("fastinvader2.wav"); } else if (counting % 4 == 2) { pSndEngine.Play2D("fastinvader3.wav"); } else if (counting % 4 == 3) { pSndEngine.Play2D("fastinvader4.wav"); } counting++; //1, using ForwardIterator ForwardIterator pIterator = new ForwardIterator(grid); Random rnd = new Random(); int num = rnd.Next(0, 11); Debug.WriteLine(" random number generated: {0}", num); Component pColumn = null; bool flag = false; for (int i = 0; i <= num; i++) { if (pColumn == null && flag == true) { break; } pColumn = pIterator.Next(); flag = true; if (pColumn == null) { break; } while (pColumn.holder != Component.Container.COMPOSITE) { pColumn = pIterator.Next(); if (pColumn == null) { break; } } } //2, using Iterator //Component pColumn = Iterator.GetChild(grid); //pColumn = Iterator.GetSibling(pColumn); if (pColumn != null) { //Debug.WriteLine(" 3, child type: {0}", pColumn); Bomb pBomb = ((AlienColumn)pColumn).ActivateBomb(rnd); pBomb.ActivateGameSprite(this.pSpriteBatch); pBomb.ActivateCollisionSprite(this.pCollisionSpriteBatch); pTree.Add(pBomb); } // Add itself back to timer TimerMan.Add(name, this, deltaTime - 0.003f); }
public IrrKlang.ISound PlaySound() { pSndEngine.SoundVolume = this.volumn; IrrKlang.ISound pSnd = pSndEngine.Play2D(this.soundFile, this.isLoop); return(pSnd); }
public static void PlaySound(Sound sound) { IrrKlang.ISoundEngine sndEngine = GetEngine(); sndEngine.Play2D(sound.source, false, false, false); }
public ISound Play2D(string soundFilename, bool playLooped, bool startPaused) { return(new IrrklangSound(engine.Play2D(soundFilename, playLooped, startPaused))); }
public static void PlaySound(Sound pSound) { Debug.Assert(pSound != null); pSoundEngine.Play2D(pSound.GetSoundSource(), false, false, false); }
public void themeSong() { music = AudioEngine.Play2D("theme.wav", true); music.Volume = 0.2f; }
//----------------------------------------------------------------------------- // Game::Update() // Called once per frame, update data, tranformations, etc // Use this function to control process order // Input, AI, Physics, Animation, and Graphics //----------------------------------------------------------------------------- public override void Update() { // Snd update - Need to be called once a frame AudioEngine.Update(); //----------------------------------------------------------- // Input Test //----------------------------------------------------------- // InputTest.KeyboardTest(); // InputTest.MouseTest(); //----------------------------------------------------------- // Sound Experiments //----------------------------------------------------------- // Adjust music theme volume if (music.Volume > 0.30f) { vol_delta = -0.002f; } else if (music.Volume < 0.00f) { vol_delta = 0.002f; } music.Volume += vol_delta; //-------------------------------------------------------- // Rotate Sprite //-------------------------------------------------------- pRedBird.angle = pRedBird.angle + 0.01f; pRedBird.Update(); //-------------------------------------------------------- // Keyboard test //-------------------------------------------------------- // Quick hack to have a one off call. // you need to release the keyboard between calls if (Azul.Input.GetKeyState(Azul.AZUL_KEY.KEY_ENTER) && prevEnterKey == 0) { prevEnterKey = Azul.AZUL_KEY.KEY_ENTER; sndShoot = AudioEngine.Play2D(srcShoot, false, false, false); } else { if (!Azul.Input.GetKeyState(Azul.AZUL_KEY.KEY_ENTER)) { prevEnterKey = 0; } } //-------------------------------------------------------- // Stats test //-------------------------------------------------------- stats.setScore(stats.getScore() + 1); if (statsCount % 400 == 0) { stats.setLevelNum(stats.getLevelNum() + 1); } if (statsCount % 50 == 0) { stats.setLineCount(stats.getLineCount() + 1); } statsCount++; }
public override void notify() { IrrKlang.ISound music = soundEngine.Play2D(soundName); music.Volume = 0.2f; }
public void playExplosion() { sndEngine.Play2D(sndExplosion, false, false, false); }