//----------------------------------------------------------------------------- // 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(); }
// 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; }
// 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)); }
protected override void derivedUpdate(ColSubject pColSubject) { //Debug.WriteLine("RemoveInvaderObserver: {0} vs {1}", pColSubject.pObjA.name, pColSubject.pObjB.name); if (pColSubject.pObjA.name == GameObject.Name.UFO) { this.pInvader = (InvaderCategory)pColSubject.pObjA; } else if (pColSubject.pObjB.name == GameObject.Name.UFO) { this.pInvader = (InvaderCategory)pColSubject.pObjB; } else { Debug.Assert(false, "Neither Object is not a UFO!"); } Debug.Assert(this.pInvader != null); if (pInvader.bMarkForDeath == false) { pInvader.bMarkForDeath = true; if (pColSubject.pObjA.name == GameObject.Name.Missle || pColSubject.pObjB.name == GameObject.Name.Missle) { OneTimeAnimation pDeathAnimation = new OneTimeAnimation(Sprite.Name.InvaderDeath, this.pInvader.x, this.pInvader.y); pDeathAnimation.Attach(Image.Name.InvaderDeath2); pDeathAnimation.Attach(Image.Name.InvaderDeath1); TimerManager.Add(TimeEvent.Name.InvaderDeath, pDeathAnimation, 0.05f); } pHardwareSound.Stop(); // Delay - remove object later RemoveUFOObserver pObserver = new RemoveUFOObserver(this); DelayedObjectManager.Attach(pObserver); } }
public void Stop() { sound.Stop(); }