override public void Notify(float xCurs, float yCurs) { var inter = ColRect.Intersect(this.pFont.pFontSprite.pColRect, new ColRect(xCurs, yCurs, 1, 1)); if (!this.pState && inter) { Sound.Name sound = Sound.Name.Uninitialized; switch (this.pRandom.Next(0, 3)) { case (0): sound = Sound.Name.Invader1; break; case (1): sound = Sound.Name.Invader2; break; case (2): sound = Sound.Name.Invader3; break; case (3): sound = Sound.Name.Invader4; break; } SoundMan.PlaySound(sound); this.pFont.SetColor(1.0f, 1.0f, 1.0f); this.pState = true; } else if (!inter) { this.pState = false; this.pFont.SetColor(0.60f, 0.60f, 0.60f); } }
override public void Execute(float deltaTime) { float value = pRandom.Next(10, 60); UFO pUFO = new UFO(GameObject.Name.UFO, GameSprite.Name.UFO, 100, 515); ColPair pColPair = ColPairMan.Add(ColPair.Name.UFO_WallLeft, pUFO, this.pWallLeft); pColPair.Attach(new UFOWallLeftObserver()); pColPair = ColPairMan.Add(ColPair.Name.UFO_WallRight, pUFO, this.pWallRight); pColPair.Attach(new UFOWallRightObserver()); MissileGroup pMissile = (MissileGroup)GameObjectMan.Find(GameObject.Name.MissileGroup); pColPair = ColPairMan.Add(ColPair.Name.UFOMissile, pUFO, pMissile); pColPair.Attach(new RemoveUFOObserver()); pUFO.ActivateCollisionSprite(this.pSB_Boxes); pUFO.ActivateGameSprite(this.pSB_Aliens); GameObjectMan.Attach(pUFO); Sound.Name pSoundName = Sound.Name.Uninitialized; switch (pRandom.Next(0, 1)) { case (0): pSoundName = Sound.Name.UFOLow; break; case (1): pSoundName = Sound.Name.UFOHigh; break; } SoundMan.PlaySound(pSoundName); TimerMan.Add(TimeEvent.Name.UFO, this, value); }
public static void Create(int reserveNum = 3, int reserveGrow = 1) { if (instance == null) { instance = new SoundMan(reserveNum, reserveGrow); } }
public override void Notify() { // Debug.WriteLine(" Snd_Listener: {0} {1}", this.pSubject.pObjA, this.pSubject.pObjB); Debug.WriteLine("Missile Hit Alien Sound"); SoundMan.Play(Sound.Name.Snd_Explosion); }
private static SoundMan privGetInstance() { if (instance == null) { instance = new SoundMan(3, 1); } return(instance); }
public override void execute(float deltaTime) { UFOMan.ActiveUFO(); SoundMan.Play("ufo_lowpitch.wav"); UfOBomb pUFOBomb = new UfOBomb(); TimerMan.Add(TimeEvent.Name.UFOBombAnination, pUFOBomb, UFOMan.getShootTime()); }
override public void Notify(float xCurs, float yCurs) { if (ColRect.Intersect(this.pFont.pFontSprite.pColRect, new ColRect(xCurs, yCurs, 1, 1))) { SceneContext.SetState(SceneContext.Scene.Aliens); SoundMan.PlaySound(Sound.Name.Shoot); } }
public static void Update() { //ensure call Create() first SoundMan pMan = SoundMan.GetInstance(); Debug.Assert(pMan != null); pMan.pSndEngine.Update(); }
// public public static void Create(int init = 5, int delta = 3) { if (pMan == null) { pMan = new SoundMan(init, delta); pMan.sndEngine = new ISoundEngine(); pMan.playing = null; } }
public static void Play(String soundPath) { //ensure call Create() first SoundMan pMan = SoundMan.GetInstance(); Debug.Assert(pMan != null); pMan.pSndEngine.Play2D(soundPath); }
public override void shootMissile(Ship pShip) { Missile pMissile = ShipMan.ActivateMissile(); pMissile.setPos(pShip.x, pShip.y + 20); SoundMan.Play("shoot.wav"); // switch states this.handle(pShip); }
public static Sound Add(Sound.Name name, string filename) { SoundMan sMan = SoundMan.privGetInstance(); Sound sound = (Sound)sMan.AddToFront(); IrrKlang.ISoundSource source = sMan.engine.AddSoundSourceFromFile(filename); source.DefaultVolume = 0.1f; sound.Initialize(name, source); return(sound); }
//--------------------------------------------------------- // Static methods //--------------------------------------------------------- public static void Create() { Debug.Assert(pInstance == null); if (pInstance == null) { pInstance = new SoundMan(); } Debug.Assert(pInstance != null); }
public override void Execute(float deltaTime) { SoundHolder pSoundHolder = (SoundHolder)this.pCurrSound.pSNext; if (pSoundHolder == null) { pSoundHolder = (SoundHolder)poFirstSound; } this.pCurrSound = pSoundHolder; SoundMan.PlaySound(pSoundHolder.pSound.name); TimerMan.Add(TimeEvent.Name.ScenePlaySound, this, deltaTime); }
public void Attach(Sound.Name soundName) { Sound pSound = SoundMan.Find(soundName); Debug.Assert(pSound != null); SoundHolder pSoundHolder = new SoundHolder(pSound); Debug.Assert(pSoundHolder != null); SLink.AddToFront(ref this.poFirstSound, pSoundHolder); this.pCurrSound = pSoundHolder; }
public override void Execute() { GameObject pA = (GameObject)this.pUFO; GameObject pB = (GameObject)Iterator.GetParent(pA); float x = this.pUFO.x; float y = this.pUFO.y; pA.Remove(); // Hacks if (this.pGameObj is MissileGroup) { Missile pMissile = (Missile)Iterator.GetChild(this.pGameObj); // bug but don't crash please if (pMissile == null) { return; } Player pPlayer = pMissile.pPlayer; pPlayer.nPoints += this.pUFO.GetPoints(); Font.Name pFontName = Font.Name.Uninitialized; if (pPlayer.n == 1) { pFontName = Font.Name.Score1Value; } if (pPlayer.n == 2) { pFontName = Font.Name.Score2Value; } Font pScore = FontMan.Find(pFontName); pScore.Set(pFontName, pPlayer.nPoints.ToString(), Glyph.Name.Consolas20pt, pScore.pFontSprite.x, pScore.pFontSprite.y); } SoundMan.PlaySound(Sound.Name.InvaderKilled); Explosion explosion = new Explosion(GameObject.Name.Explosion, GameSprite.Name.Explosion, x, y); SpriteBatch pSB_UFOs = SpriteBatchMan.Find(SpriteBatch.Name.Aliens); explosion.ActivateGameSprite(pSB_UFOs); GameObjectMan.Attach(explosion); TimerMan.Add(TimeEvent.Name.RemoveExplosion, new RemoveExplosionCommand(explosion), 0.25f); }
public static void PlaySound(Sound.Name name, float volume = 1.0f) { Debug.Assert(name != Sound.Name.Uninitialized); SoundMan sMan = SoundMan.privGetInstance(); Sound pHead = (Sound)sMan.pActive; while (pHead != null) { if (pHead.name == name) { IrrKlang.ISound sound = sMan.engine.Play2D(pHead.source, false, false, false); } pHead = (Sound)pHead.pNext; } }
public override void update(Scene pScene, float currTime) { // Add your update below this line: ---------------------------- SoundMan.Update(); InputMan.Update(); TimerMan.Update(currTime); GameObjectMan.Update(); // check collision CollisionPairMan.Process(); // Delete any objects here... DelayedObjectMan.Process(); }
public override void Notify() { this.pBomb = (Bomb)this.pSubject.pObjA; MissileGroup pMissileGroup = (MissileGroup)this.pSubject.pObjB; this.pMissile = (Missile)Iterator.GetChild(pMissileGroup); Debug.Assert(this.pMissile != null); if (this.pBomb.bMarkForDeath == false) { this.pBomb.bMarkForDeath = true; } if (this.pMissile.bMarkForDeath == false) { this.pBomb.bMarkForDeath = true; } // Delay RemoveMissileAndBombObserver pObserver = new RemoveMissileAndBombObserver((Bomb)this.pBomb, (Missile)this.pMissile); DelayedObjectMan.Attach(pObserver); //--------------------------------------------------------------------------------------------------------- // Sound //--------------------------------------------------------------------------------------------------------- SoundMan.PlaySound(Sound.Name.InvaderKilled); TimeEvent pTimeEvent = TimerMan.Find(TimeEvent.Name.ScenePlaySound); //--------------------------------------------------------------------------------------------------------- // Explosion //--------------------------------------------------------------------------------------------------------- Explosion explosion = new Explosion(GameObject.Name.Explosion, GameSprite.Name.Explosion, this.pBomb.x, this.pBomb.y); SpriteBatch pSB_Aliens = SpriteBatchMan.Find(SpriteBatch.Name.Aliens); explosion.ActivateGameSprite(pSB_Aliens); GameObjectMan.Attach(explosion); TimerMan.Add(TimeEvent.Name.RemoveExplosion, new RemoveExplosionCommand(explosion), 0.25f); }
//---------------------------------------------------------------------- // Override Abstract methods //---------------------------------------------------------------------- public override void execute(float deltaTime) { // get next image ImageHolder pImageHolder = (ImageHolder)this.pCurrImage.pNext; SoundHolder pSoundHolder = (SoundHolder)this.pCurrSound.pNext; // if at the end of the list, set first image back if (pImageHolder == null) { pImageHolder = (ImageHolder)this.poFirstImage; } if (pSoundHolder == null) { pSoundHolder = (SoundHolder)this.poFirstSound; } this.pCurrImage = pImageHolder; this.pCurrSound = pSoundHolder; // change image this.pGameSprite.swapImage(pImageHolder.getImage()); SoundMan.Play(pSoundHolder.getSound()); // Add itself back to TimerMan if (this.pGameSprite.getName() == GameSprite.Name.Squid) { TimerMan.Add(TimeEvent.Name.SquidAnimation, this, deltaTime); } else if (this.pGameSprite.getName() == GameSprite.Name.Crab) { TimerMan.Add(TimeEvent.Name.CrabAnimation, this, deltaTime); } else if (this.pGameSprite.getName() == GameSprite.Name.Octopus) { TimerMan.Add(TimeEvent.Name.OctopusAnimation, this, deltaTime); } }
public override void Execute() { GameObject pA = (GameObject)this.pBrick; GameObject pB = (GameObject)Iterator.GetParent(pA); pA.Remove(); if (!(this.pObjA is AlienGrid)) { SoundMan.PlaySound(Sound.Name.Explode); } if (privCheckParent(pB) == true) { GameObject pC = (GameObject)Iterator.GetParent(pB); pB.Remove(); if (privCheckParent(pC) == true) { //pC.Remove(); } } }
//----------------------------------------------------------------------------- // Game::LoadContent() // Allows you to load all content needed for your engine, // such as objects, graphics, etc. //----------------------------------------------------------------------------- public override void LoadContent() { //--------------------------------------------------------------------------------------------------------- // Initialize managers //--------------------------------------------------------------------------------------------------------- // Initialize and Add All Texture TextureMan.Initialize(); TextureMan.AddAll(); // Initialize and Add All image ImageMan.Initialize(); ImageMan.AddAll(); // Initialize and Add All Sprites GameSpriteMan.Initialize(); GameSpriteMan.AddAll(); // Initialize and Add All Sounds SoundMan.Initialize(); SoundMan.AddAll(); // Initialize Input and Output GlyphMan.Initialize(); GlyphMan.AddXml(GlyphName.Consolas36pt, "Consolas36pt.xml", TextureName.Consolas); FontMan.Initialize(); InputMan.Initialize(); // Initialize TimerEvents TimerMan.Initialize(); // Initialize GameObj and Collision PlayBatchMan.Initialize(); // ***** Scene ***** SceneContext.Initialize(); }
//------------------------------------------------------------------------------- // Override abstract methods //------------------------------------------------------------------------------- public override void notify() { SoundMan.Play(this.soundPath); }
public override void Update() { // Add your update below this line: ---------------------------- //----------------------------------------------------------- // Sound Update - place here: //----------------------------------------------------------- //--------------------------------------------------------------------------------------------------------- // Font Experiment //--------------------------------------------------------------------------------------------------------- Font pTestMessage = FontMan.Find(Font.Name.TestMessage); Debug.Assert(pTestMessage != null); pTestMessage.UpdateMessage("dog " + count++); // walk through all objects and push to proxy GameObjectMan.Update(); // Do the collision checks ColPairMan.Process(); //----------------------------------------------------------- // Sound Experiments //----------------------------------------------------------- // Adjust music theme volume Sound tmpSnd = SoundMan.Find(Sound.Name.Snd_Theme); float vol = tmpSnd.GetVolume(); if (vol > 0.30f) { vol_delta = -0.002f; } else if (vol < 0.00f) { vol_delta = 0.002f; } tmpSnd.SetVolume(vol + vol_delta); InputMan.Update(); // Load by file missileCount++; if (missileCount == 200) { missileCount = 0; // play one by file, not by load SoundMan.Play(Sound.Name.Snd_Shoot); } //// Trigger already loaded sounds //if (pMissile.y > 500.0f || pMissile.y < 100.0f) //{ // pMissile.speed *= -1.0f; // switch (count%4) // { // case 0: // SoundMan.Play(Sound.Name.Snd_HitWall); // break; // case 1: // SoundMan.Play(Sound.Name.Snd_Explosion); // break; // case 2: // SoundMan.Play(Sound.Name.Snd_UFO1); // break; // case 3: // SoundMan.Play(Sound.Name.Snd_UFO2); // break; // default: // Debug.Assert(false); // break; // } //} // Fire off the timer events TimerMan.Update(this.GetTime()); GameObjectMan.Update(); //Debug.WriteLine("\n------------------------------------"); ColPairMan.Process(); }
//----------------------------------------------------------------------------- // Game::LoadContent() // Allows you to load all content needed for your engine, // such as objects, graphics, etc. //----------------------------------------------------------------------------- public override void LoadContent() { //--------------------------------------------------------------------------------------------------------- // Setup Managers //--------------------------------------------------------------------------------------------------------- TextureMan.Create(1, 1); ImageMan.Create(5, 2); GameSpriteMan.Create(4, 2); BoxSpriteMan.Create(3, 1); SpriteBatchMan.Create(3, 1); TimerMan.Create(3, 1); ProxyMan.Create(10, 1); GameObjectMan.Create(10, 5); ColPairMan.Create(3, 1); GlyphMan.Create(3, 1); FontMan.Create(1, 1); //--------------------------------------------------------------------------------------------------------- // Sound Experiment //--------------------------------------------------------------------------------------------------------- SoundMan.Create(5, 3); SoundMan.LoadAll(); // play a sound file SoundMan.PlayMusic(Sound.Name.Snd_Theme); SoundMan.Find(Sound.Name.Snd_Theme).SetVolume(0.2f); //--------------------------------------------------------------------------------------------------------- // Load the Textures //--------------------------------------------------------------------------------------------------------- TextureMan.Add(Texture.Name.Birds, "Birds.tga"); TextureMan.Add(Texture.Name.PacMan, "PacMan.tga"); TextureMan.Add(Texture.Name.Consolas, "Consolas20pt.tga"); TextureMan.Add(Texture.Name.Invader_3, "Invaders_3.tga"); TextureMan.Add(Texture.Name.Invader_4, "Invaders_4.tga"); TextureMan.LoadTexture(); //--------------------------------------------------------------------------------------------------------- // Create Images //--------------------------------------------------------------------------------------------------------- // --- angry birds --- ImageMan.Add(Image.Name.RedBird, Texture.Name.Birds, 47, 41, 48, 46); ImageMan.Add(Image.Name.YellowBird, Texture.Name.Birds, 124, 34, 60, 56); ImageMan.Add(Image.Name.GreenBird, Texture.Name.Birds, 246, 135, 99, 72); ImageMan.Add(Image.Name.WhiteBird, Texture.Name.Birds, 139, 131, 84, 97); ImageMan.Add(Image.Name.BlueBird, Texture.Name.Birds, 301, 49, 33, 33); // --- Pacman Ghosts --- ImageMan.Add(Image.Name.RedGhost, Texture.Name.PacMan, 616, 148, 33, 33); ImageMan.Add(Image.Name.PinkGhost, Texture.Name.PacMan, 663, 148, 33, 33); ImageMan.Add(Image.Name.BlueGhost, Texture.Name.PacMan, 710, 148, 33, 33); ImageMan.Add(Image.Name.OrangeGhost, Texture.Name.PacMan, 757, 148, 33, 33); // --- Alians --- ImageMan.LoadImage(); //--------------------------------------------------------------------------------------------------------- // Create Sprites //--------------------------------------------------------------------------------------------------------- // --- BoxSprites --- BoxSpriteMan.Add(550.0f, 500.0f, 50.0f, 150.0f, new Azul.Color(1.0f, 1.0f, 1.0f, 1.0f)); BoxSpriteMan.Add(550.0f, 100.0f, 50.0f, 100.0f); GameSpriteMan.Add(GameSprite.Name.RedBird, Image.Name.RedBird, 50, 500, 50, 50); GameSpriteMan.Add(GameSprite.Name.YellowBird, Image.Name.YellowBird, 300, 400, 50, 50); GameSpriteMan.Add(GameSprite.Name.GreenBird, Image.Name.GreenBird, 400, 200, 50, 50); GameSpriteMan.Add(GameSprite.Name.WhiteBird, Image.Name.WhiteBird, 600, 200, 100, 100); GameSpriteMan.Add(GameSprite.Name.BlueBird, Image.Name.BlueBird, 50, 50, 50, 50); GameSpriteMan.Add(GameSprite.Name.RedGhost, Image.Name.RedGhost, 100, 300, 100, 100); GameSpriteMan.Add(GameSprite.Name.PinkGhost, Image.Name.PinkGhost, 300, 300, 100, 100); GameSpriteMan.Add(GameSprite.Name.BlueGhost, Image.Name.BlueGhost, 500, 300, 100, 100); GameSpriteMan.Add(GameSprite.Name.OrangeGhost, Image.Name.OrangeGhost, 700, 300, 100, 100); GameSpriteMan.LoadGameSprite(); // Create SpriteBatch //--------------------------------------------------------------------------------------------------------- SpriteBatch pSB_Texts = SpriteBatchMan.Add(SpriteBatch.Name.Batch_Texts); SpriteBatch pSB_Birds = SpriteBatchMan.Add(SpriteBatch.Name.Batch_AngryBirds); SpriteBatch pSB_Alieans = SpriteBatchMan.Add(SpriteBatch.Name.Batch_Aliens); SpriteBatch pSB_Box = SpriteBatchMan.Add(SpriteBatch.Name.Batch_Boxes); //--------------------------------------------------------------------------------------------------------- // Attach to Sprite Batch //--------------------------------------------------------------------------------------------------------- pSB_Birds.Attach(GameSprite.Name.RedBird); pSB_Birds.Attach(GameSprite.Name.YellowBird); pSB_Birds.Attach(GameSprite.Name.GreenBird); pSB_Birds.Attach(GameSprite.Name.WhiteBird); //--------------------------------------------------------------------------------------------------------- // Proxy //--------------------------------------------------------------------------------------------------------- // create 10 proxies for (int i = 0; i < 10; i++) { ProxySprite pProxy = ProxyMan.Add(GameSprite.Name.YellowBird); pProxy.x = 50.0f + 70 * i; pProxy.y = 100.0f; pSB_Birds.Attach(pProxy); } //--------------------------------------------------------------------------------------------------------- // Game Object //--------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------- // Create Birds //--------------------------------------------------------------------------------------------------------- // create the factory BirdFactory BF = new BirdFactory(SpriteBatch.Name.Batch_AngryBirds); BirdGrid pGrid = (BirdGrid)BF.Create(GameObject.Name.BirdGrid, BirdCategory.Type.Grid); GameObjectMan.Attach(pGrid); BF.LoadAll(pGrid); AliensFactory af = new AliensFactory(SpriteBatch.Name.Batch_Aliens); GameObject pAlienGrid = af.Create(GameObject.Name.Aliens_Grid, AlienCategory.Type.Grid); GameObjectMan.Attach(pAlienGrid); af.LoadAll(pAlienGrid); //pAlienGrid.Print(); //--------------------------------------------------------------------------------------------------------- // Create Walls //--------------------------------------------------------------------------------------------------------- // Wall Root WallFactory WF = new WallFactory(); WallGrid pWallGrid = (WallGrid)WF.Create(GameObject.Name.Wall_Grid, WallCategory.Type.Wall_Grid, 0.0f, 0.0f); GameObjectMan.Attach(pWallGrid); WallLeft pWallLeft = (WallLeft)WF.Create(GameObject.Name.Wall_Left, WallCategory.Type.Wall_Left, 20, 280, 20, 500); WallRight pWallRight = (WallRight)WF.Create(GameObject.Name.Wall_Right, WallCategory.Type.Wall_Right, 780, 280, 20, 500); WallTop pWallTop = (WallTop)WF.Create(GameObject.Name.Wall_Top, WallCategory.Type.Wall_Top, 400, 530, 700, 20); WallBottom pWallBottom = (WallBottom)WF.Create(GameObject.Name.Wall_Bottom, WallCategory.Type.Wall_Bottom, 400, 20, 700, 20); // Add to the composite the children pWallGrid.Add(pWallRight); pWallGrid.Add(pWallLeft); pWallGrid.Add(pWallTop); pWallGrid.Add(pWallBottom); //--------------------------------------------------------------------------------------------------------- // Create Missile //--------------------------------------------------------------------------------------------------------- MissileFactory MF = new MissileFactory(SpriteBatch.Name.Batch_Aliens); MissileGrid pMissileGrid = (MissileGrid)MF.Create(GameObject.Name.Missile_Grid, MissileCategory.Type.Missile_Grid); GameObjectMan.Attach(pMissileGrid); Missile pMissile = (Missile)MF.Create(GameObject.Name.Missile, MissileCategory.Type.Missile, 405, 100); pMissileGrid.Add(pMissile); Debug.WriteLine("-------------------"); //--------------------------------------------------------------------------------------------------------- // ColPair //--------------------------------------------------------------------------------------------------------- // associate in a collision pair ColPair pair = ColPairMan.Add(pMissileGrid, pAlienGrid); pair.Attach(new MissileHitAlienAnim()); pair.Attach(new MissileHitAlienSnd()); ColPairMan.Add(pWallGrid, pAlienGrid); ColPairMan.Add(pWallGrid, pMissileGrid); //--------------------------------------------------------------------------------------------------------- // Font Experiment //--------------------------------------------------------------------------------------------------------- GlyphMan.AddXml(Glyph.Name.Consolas36pt, "Consolas36pt.xml", Texture.Name.Consolas); FontMan.Add(Font.Name.TestMessage, SpriteBatch.Name.Batch_Texts, "ABC", Glyph.Name.Consolas36pt, 500, 500); FontMan.Add(Font.Name.TestOneOff, SpriteBatch.Name.Batch_Texts, "XYZ1234!#=+ZYX", Glyph.Name.Consolas36pt, 200, 200); }
public override void Execute() { GameObject pA = (GameObject)this.pAlien; GameObject pB = (GameObject)Iterator.GetParent(pA); float x = this.pAlien.x; float y = this.pAlien.y; AlienGrid pGrid = (AlienGrid)this.pAlien.pParent.pParent; pGrid.nNumActive--; pA.Remove(); // TODO: Need a better way... if (privCheckParent(pB) == true) { GameObject pC = (GameObject)Iterator.GetParent(pB); pB.Remove(); if (privCheckParent(pC) == true) { pC.Remove(); } } Missile pMissile = (Missile)this.pGameObj; Player pPlayer = pMissile.pPlayer; // Font.Name pFontName = Font.Name.Uninitialized; if (this.pGameObj is MissileCategory) { pPlayer.nPoints += this.pAlien.GetPoints(); Font pScore = null; if (pPlayer.n == 1) { pScore = FontMan.Find(Font.Name.Score1Value); pFontName = Font.Name.Score1Value; } if (pPlayer.n == 2) { pScore = FontMan.Find(Font.Name.Score2Value); pFontName = Font.Name.Score2Value; } pScore.Set(pFontName, pPlayer.nPoints.ToString(), Glyph.Name.Consolas20pt, pScore.pFontSprite.x, pScore.pFontSprite.y); } //--------------------------------------------------------------------------------------------------------- // Sound //--------------------------------------------------------------------------------------------------------- SoundMan.PlaySound(Sound.Name.InvaderKilled); TimeEvent pTimeEvent = TimerMan.Find(TimeEvent.Name.ScenePlaySound); pTimeEvent.deltaTime -= 0.01f; //--------------------------------------------------------------------------------------------------------- // Explosion //--------------------------------------------------------------------------------------------------------- Explosion explosion = new Explosion(GameObject.Name.Explosion, GameSprite.Name.Explosion, x, y); SpriteBatch pSB_Aliens = SpriteBatchMan.Find(SpriteBatch.Name.Aliens); explosion.ActivateGameSprite(pSB_Aliens); GameObjectMan.Attach(explosion); TimerMan.Add(TimeEvent.Name.RemoveExplosion, new RemoveExplosionCommand(explosion), 0.25f); //--------------------------------------------------------------------------------------------------------- // Scene Transition //--------------------------------------------------------------------------------------------------------- if (pGrid.nNumActive == 0 && pPlayer.nCurrLevel == 1) { PlayerMan.WriteHighScores(); pPlayer.nCurrLevel++; SceneContext.GetState().Initialize(); if (SceneContext.bMultiplayer) { SceneContext.SetState(SceneContext.Scene.MultiPlay); } else { SceneContext.SetState(SceneContext.Scene.SinglePlay); } } else if (pGrid.nNumActive == 0 && pPlayer.nCurrLevel == 2) { PlayerMan.WriteHighScores(); SceneContext.SetState(SceneContext.Scene.Credits); } }
//------------------------------------------------------------------------------- // Methods //------------------------------------------------------------------------------- public void create(Manager.Name managerName, int reserveNum = 3, int growNum = 1) { switch (managerName) { case Manager.Name.TextureMan: TextureMan.Create(reserveNum, growNum); break; case Manager.Name.ImageMan: ImageMan.Create(reserveNum, growNum); break; case Manager.Name.GameSpriteMan: GameSpriteMan.Create(reserveNum, growNum); break; case Manager.Name.BoxSpriteMan: BoxSpriteMan.Create(reserveNum, growNum); break; case Manager.Name.SpriteBatchMan: SpriteBatchMan.Create(reserveNum, growNum); break; case Manager.Name.TimerMan: TimerMan.Create(reserveNum, growNum); break; case Manager.Name.ProxySpriteMan: ProxySpriteMan.Create(reserveNum, growNum); break; case Manager.Name.GameObjectMan: GameObjectMan.Create(reserveNum, growNum); break; case Manager.Name.CollisionPairMan: CollisionPairMan.Create(reserveNum, growNum); break; case Manager.Name.GlyphMan: GlyphMan.Create(reserveNum, growNum); break; case Manager.Name.FontMan: FontMan.Create(reserveNum, growNum); break; case Manager.Name.ShipMan: ShipMan.Create(); break; case Manager.Name.BombMan: BombMan.Create(); break; case Manager.Name.SoundMan: SoundMan.Create(); break; case Manager.Name.AlienMan: AlienMan.Create(); break; case Manager.Name.UFOMan: UFOMan.Create(); break; case Manager.Name.SceneMan: SceneMan.Create(); break; default: Debug.Assert(false); break; } }
public override void Notify() { SoundMan.PlaySound(Sound.Name.Shoot); pShip.ShootMissile(); }