public static Font Add(Font.Name name, SpriteBatch.Name SB_Name, String pMessage, Glyph.Name glyphName, float xStart, float yStart) { FontMan pMan = FontMan.privGetInstance(); Font pNode = (Font)pMan.baseAdd(); Debug.Assert(pNode != null); pNode.Set(name, pMessage, glyphName, xStart, yStart); // Add to sprite batch SpriteBatch pSB = SpriteBatchMan.Find(SB_Name); Debug.Assert(pSB != null); Debug.Assert(pNode.pFontSprite != null); pSB.Attach(pNode.pFontSprite); return(pNode); }
// PA2: Factory Method public Font AddFont(Font.Name name, SpriteBatch.Name SB_Name, String pMessage, Glyph.Name glyphName, float xStart, float yStart) { Font pNode = (Font)this.PullFromReserved(); Debug.Assert(pNode != null); pNode.Set(name, pMessage, glyphName, xStart, yStart); // Add to sprite batch SpriteBatch sb = SpriteBatchManager.getInstance().AddSpriteBatch(SB_Name, 1); sb.AddSprite(pNode.pFontSprite); Debug.Assert(pNode.pFontSprite != null); this.Add(pNode); return(pNode); }
public static Font Add(Font.Name name, SpriteBatch.Name SB_Name, String pMessage, Glyph.Name glyphName, float x, float y) { FontMan pFMan = FontMan.PrivGetInstance(); Debug.Assert(pFMan != null); Font pFNode = (Font)pFMan.BaseAdd(); Debug.Assert(pFNode != null); pFNode.Set(name, pMessage, glyphName, x, y); SpriteBatch pSpriteBatch = SpriteBatchMan.Find(SB_Name); Debug.Assert(pSpriteBatch != null); Debug.Assert(pFNode.pFontSprite != null); pSpriteBatch.Attach(pFNode.pFontSprite); return(pFNode); }
public static void Update(Font.Name name, int pNewMessage) { Font pFont = FontManager.Find(name); Debug.Assert(pFont != null); String temp = pNewMessage.ToString(); if (pNewMessage < 10) { temp = "000" + temp; } else if (pNewMessage < 100) { temp = "00" + temp; } else if (pNewMessage < 1000) { temp = "0" + temp; } pFont.UpdateMessage(temp); }
public PlayerDeathObserver(PlayerDeathObserver pdo) { this.playerName = pdo.playerName; this.livesFont = pdo.livesFont; }
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); } }