// TODO probably remove this method because no longer used. Update handled in game objects public static void Update() { SpriteBatchManager pMan = SpriteBatchManager.PrivGetInstance(); Debug.Assert(pMan != null); // walk through the list and render SpriteBatch pSpriteBatch = (SpriteBatch)pMan.BaseGetActive(); while (pSpriteBatch != null) { SpriteBaseNodeManager pSBNodeMan = pSpriteBatch.GetSBNodeManager(); Debug.Assert(pSBNodeMan != null); SpriteBaseNode pNode = (SpriteBaseNode)pSBNodeMan.BaseGetActive(); while (pNode != null) { pNode.pSpriteBase.Update(); pNode = (SpriteBaseNode)pNode.GetNext(); } pSpriteBatch = (SpriteBatch)pSpriteBatch.GetNext(); } }
public AlienFactory(SpriteBatchName sbName, PCSTree tree) { this.pSpriteBatch = SpriteBatchManager.Find(sbName); this.pSpriteBoxBatch = SpriteBatchManager.Find(SpriteBatchName.Boxes); Debug.Assert(this.pSpriteBatch != null); this.pTree = tree; }
public void activate(Ship ship) { //SpriteBatch boxBatch = SpriteBatchManager.find(SpriteBatch.SpriteBatchName.Boxes); this.cPCSTree.Insert(ship, this.cParent); ship.addSpriteToBatch(this.cSpriteBatch); ship.addCollisionToBatch(SpriteBatchManager.find(SpriteBatch.SpriteBatchName.Boxes)); }
public void activate(Bomb bomb) { //SpriteBatch boxBatch = SpriteBatchManager.find(SpriteBatch.SpriteBatchName.Boxes); this.cPCSTree.Insert(bomb, this.cParent); bomb.addSpriteToBatch(this.cSpriteBatch); bomb.addCollisionToBatch(SpriteBatchManager.find(SpriteBatch.SpriteBatchName.Boxes)); }
public virtual void Remove() { Debug.WriteLine("REMOVE GAME OBJECT: {0}", this); // Remove proxy sprite from SpriteBatch Debug.Assert(this.pProxySprite != null); SBNode pSBNode = this.pProxySprite.GetSBNode(); Debug.Assert(pSBNode != null); SpriteBatchManager.Remove(pSBNode); // Remove collision sprite box from spriteBatch Debug.Assert(this.poColObj != null); Debug.Assert(this.poColObj.pColSprite != null); pSBNode = this.poColObj.pColSprite.GetSBNode(); Debug.Assert(pSBNode != null); SpriteBatchManager.Remove(pSBNode); // Remove from GameObjectMan GameObjectManager.Remove(this); //add to the ghost manager since it's a dead object GhostManager.Add(this); }
public Ship createShip(Ship.ShipType mShipType, GameObject.GameObjectName gameName, int index = 0, float mX = 0.0f, float mY = 0.0f) { Ship ship = null; switch (mShipType) { case Ship.ShipType.ShipRoot: ship = new ShipRoot(gameName, Sprite.SpriteName.NullObject, index, mX, mY); GameObjectNodeManager.add(ship, cPCSTree); break; case Ship.ShipType.CannonShip: ship = new CannonShip(gameName, Sprite.SpriteName.CannonShip, index, mX, mY); // ship = cannonShip; break; case Ship.ShipType.Uninitilized: Debug.WriteLine("Missile Type is Uninitilized"); break; } this.cPCSTree.Insert(ship, this.cParent); // cSpriteBatch.addToBatch(ship.getProxySprite()); // cSpriteBatch.addToBatch(ship.getCollisionObj().cSpriteBox); ship.addSpriteToBatch(this.cSpriteBatch); ship.addCollisionToBatch(SpriteBatchManager.find(SpriteBatch.SpriteBatchName.Boxes)); return(ship); }
public static Missile ActivateMissile() { ShipManager pShipMan = ShipManager.privInstance(); Debug.Assert(pShipMan != null); // get the game object tree PCSTree pTree = GameObjectManager.GetRootTree(); Debug.Assert(pTree != null); //create a new missile!! // copy over safe copy (create a new one or find in game object tree) Missile pMissile = new Missile(GameObject.Name.Missile, GameSprite.Name.Missile, 0, 400, 100); pShipMan.pMissile = pMissile; // Attach missile to SpriteBatches SpriteBatch pSB_Aliens = SpriteBatchManager.Find(SpriteBatch.Name.GameSprites); SpriteBatch pSB_Boxes = SpriteBatchManager.Find(SpriteBatch.Name.SpriteBoxes); pMissile.ActivateCollisionSprite(pSB_Boxes); pMissile.ActivateGameSprite(pSB_Aliens); // Attach the missile to the missile root GameObject pMissileRoot = GameObjectManager.Find(GameObject.Name.MissileRoot); Debug.Assert(pMissileRoot != null); // Add to GameObject Tree - {update and collisions} pTree.Insert(pShipMan.pMissile, pMissileRoot); return(pShipMan.pMissile); }
public UFO createUFO(UFO.UFOType mUfoType, GameObject.GameObjectName gameName, int index = 0, float mX = 0.0f, float mY = 0.0f) { UFO ufo = null; switch (mUfoType) { case UFO.UFOType.UFORoot: ufo = new UFORoot(gameName, Sprite.SpriteName.NullObject, index, mX, mY, UFO.UFOType.UFORoot); GameObjectNodeManager.add(ufo, cPCSTree); break; case UFO.UFOType.AlienUFO: ufo = new AlienUFO(gameName, Sprite.SpriteName.AlienUFO, index, mX, mY, UFO.UFOType.AlienUFO); break; case UFO.UFOType.Uninitilized: Debug.WriteLine("ufo Type is Uninitilized"); break; } this.cPCSTree.Insert(ufo, this.cParent); ufo.addSpriteToBatch(this.cSpriteBatch); ufo.addCollisionToBatch(SpriteBatchManager.find(SpriteBatch.SpriteBatchName.Boxes)); return(ufo); }
public void DeactivateCollisionSprite() { SpriteBatchNode sbNode = this.pCollisionObject.pCollisionSpriteBox.GetSpriteBatchNode(); Debug.Assert(sbNode != null); SpriteBatchManager.Remove(sbNode); }
public void RemoveFromSpriteBatch() { Debug.Assert(this.pProxySprite != null); Debug.Assert(this.pColObject != null); SBNode pSBNode; if(this.type == Composite.Container.LEAF) { if(!(this is ExplosionCategory)) { pSBNode = this.pColObject.pBoxSprite.GetBackToSBNode(); // Some of Leaf object don't have COllision box. if (pSBNode != null) { SpriteBatchManager.Remove(pSBNode); } } pSBNode = this.pProxySprite.GetBackToSBNode(); SpriteBatchManager.Remove(pSBNode); } else if(this.type == Composite.Container.COMPOSITE) { pSBNode = this.pColObject.pBoxSprite.GetBackToSBNode(); SpriteBatchManager.Remove(pSBNode); } }
public override void ReinitializeLevel(GameManager pGameManager) { SoundManager.StopAllSounds(); TimerManager.PurgeAllNodes(); GameObjectManager.PurgeAllNodes(); SpriteBatch pSBatch = SpriteBatchManager.Find(SpriteBatch.Name.Boxes); pSBatch.GetSBNodeManager().PurgeAllNodes(); pSBatch = SpriteBatchManager.Find(SpriteBatch.Name.Sprites); pSBatch.GetSBNodeManager().PurgeAllNodes(); ColPairManager.PurgeAllNodes(); DelayedObjectManager.PurgeAll(); if (pGameManager.pActivePlayer.name == PlayerArtifact.Name.PlayerOne) { PlayerOneInit(pGameManager); pGameManager.poPlayer1.RestoreManagerStates(pGameManager.pGame.GetTime()); pGameManager.SetActivePlayer(PlayerArtifact.Name.PlayerOne); } else { PlayerTwoInit(pGameManager); pGameManager.poPlayer2.RestoreManagerStates(pGameManager.pGame.GetTime()); pGameManager.SetActivePlayer(PlayerArtifact.Name.PlayerTwo); } }
public override void Execute(float deltaTime) { GhostManager pGhostManager = GameStateManager.GetGame().GetStateGhostManager(); GameObjectManager pGameObjectManager = GameStateManager.GetGame().GetStateGameObjectManager(); SpriteBatchManager pSpriteBatchManager = GameStateManager.GetGame().GetStateSpriteBatchManager(); Composite pCoreCannonGroup = GameStateManager.GetGame().GetStateCompositeManager().Find(Composite.CompositeName.CoreCannonGroup); GameObject pGameObj = pGhostManager.Find(GameObject.Name.CoreCannon); // Remove game object from ghost manager pGhostManager.Detach(pGameObj); // Reset position pGameObj.SetX(200); pGameObj.SetY(100); // Reset Collision Object Azul.Rect pSpriteProxyScreenRect = pGameObj.GetSpriteProxy().GetSpriteScreenRect(); CollisionObject pCollisionObject = pGameObj.GetCollisionObject(); pCollisionObject.GetCollisionRect().Set(pSpriteProxyScreenRect); pCollisionObject.GetCollisionSpriteBox().Set(SpriteBox.Name.Box, 200, 100, pSpriteProxyScreenRect.width, pSpriteProxyScreenRect.height); // Add to GameObjectManager Debug.Assert(pGameObj != null); pGameObjectManager.Attach(pGameObj); // Add to Composite pCoreCannonGroup.Add(pGameObj); // Attach to SpriteBatch pGameObj.ActivateSprite(pSpriteBatchManager.Find(SpriteBatch.Name.CoreCannon)); pGameObj.ActivateCollisionSprite(pSpriteBatchManager.Find(SpriteBatch.Name.CollisionBox)); }
public static Missile ActivateMissile() { ShipManager shipMan = ShipManager.GetInstance(); PCSTree pcsTree = GameObjectManager.GetRootTree(); Debug.Assert(pcsTree != null); Missile pMissile = new Missile(GameObjectName.Missile, SpriteBaseName.Missile, 400.0f, 100.0f, 0); pMissile.pProxySprite.pSprite.SetColor(ColorFactory.Create(ColorName.Green).pAzulColor); shipMan.pMissile = pMissile; SpriteBatch sbAliens = SpriteBatchManager.Find(SpriteBatchName.Aliens); SpriteBatch sbBoxes = SpriteBatchManager.Find(SpriteBatchName.Boxes); pMissile.ActivateCollisionSprite(sbBoxes); pMissile.ActivateGameSprite(sbAliens); GameObject pMissileRoot = GameObjectManager.Find(GameObjectName.MissileRoot); Debug.Assert(pMissileRoot != null); pcsTree.Insert(shipMan.pMissile, pMissileRoot); return(shipMan.pMissile); }
public Missile createMissile(Missile.MissileType mMissileType, GameObject.GameObjectName gameName, int index = 0, float mX = 0.0f, float mY = 0.0f) { Missile missile = null; switch (mMissileType) { case Missile.MissileType.MissileRoot: missile = new MissileRoot(gameName, Sprite.SpriteName.NullObject, index, mX, mY, Missile.MissileType.MissileRoot); GameObjectNodeManager.add(missile, cPCSTree); break; case Missile.MissileType.StraightMissile: missile = new StraightMissile(gameName, Sprite.SpriteName.StraightMissile, index, mX, mY, Missile.MissileType.StraightMissile); break; case Missile.MissileType.Uninitilized: Debug.WriteLine("Missile Type is Uninitilized"); break; } this.cPCSTree.Insert(missile, this.cParent); // cSpriteBatch.addToBatch(missile.getProxySprite()); // cSpriteBatch.addToBatch(missile.getCollisionObj().cSpriteBox); missile.addSpriteToBatch(this.cSpriteBatch); missile.addCollisionToBatch(SpriteBatchManager.find(SpriteBatch.SpriteBatchName.Boxes)); return(missile); }
public override void update() { if (GlobalTimer.player2 == -1f) { GlobalTimer.player2Delta = GlobalTimer.currentTime; } GlobalTimer.player2 = GlobalTimer.currentTime - GlobalTimer.player1Delta; // update shared objects SpriteBatchManager.getInstance().FindSpriteBatchByName(SpriteBatch.Name.Shared).UpdateAllNodes(); // update score bar SpriteBatchManager.getInstance().FindSpriteBatchByName(SpriteBatch.Name.ScoreBar).UpdateAllNodes(); // update current player SpriteBatchManager.getInstance().FindSpriteBatchByName(SpriteBatch.Name.Player2).UpdateAllNodes(); // update timer events TimerManager.getInstance().Update(GlobalTimer.currentTime); // update observers SubjectManager.getInstance().UpdateSubjects(); // update collision ColliPairManager.getInstance().Process(); // level up logic if (GlobalPlayerStats.Player2.alienLeft == 0) { this.LevelUp(); } }
private SpriteBatchManager() : base() // <--- Kick the can (delegate) { SpriteBatchManager.pActiveSBMan = null; // initialize derived data here SpriteBatchManager.poNodeCompare = new SpriteBatch(); }
public virtual void Remove() { // Keenan(delete.A) // ----------------------------------------------------------------- // Very difficult at first... if you are messy, you will pay here! // Given a game object.... // ----------------------------------------------------------------- // Remove proxy sprite node from SpriteBatch manager Debug.Assert(this.pProxySprite != null); SpriteNode pSpriteNode = this.pProxySprite.GetSpriteNode(); Debug.Assert(pSpriteNode != null); SpriteBatchManager.Remove(pSpriteNode); // Remove collision sprite node from spriteBatch manager Debug.Assert(this.poColObj != null); Debug.Assert(this.poColObj.pColSprite != null); pSpriteNode = this.poColObj.pColSprite.GetSpriteNode(); Debug.Assert(pSpriteNode != null); SpriteBatchManager.Remove(pSpriteNode); // Remove game object node from GameObjectMan //Remove from parent composite in derived class remove() instead //never need to remove composites from GameObject Manager...right? //GameObjectManager.Remove(this); }
//called from column ( (GameObject)this.pParent ); public override void DropBomb() { float bomb_startPosX = this.x; float bomb_startPosY = this.y; //Bomb pBomb = new Bomb(GameObject.Name.Bomb, GameSprite.Name.CrossAlienBomb, new FallStraight(), 0, bomb_startPosX, bomb_startPosY); //Debug.Assert(pBomb != null); Random r = new Random(); int randomBombType = r.Next(1, 4); Bomb pBomb = privCreateBomb(randomBombType, bomb_startPosX, bomb_startPosY); //get the root tree PCSTree rootGamObjTree = GameObjectManager.GetRootTree(); Debug.Assert(rootGamObjTree != null); //find the bomb root GameObject pBombRoot = GameObjectManager.Find(GameObject.Name.BombRoot); Debug.Assert(pBombRoot != null); rootGamObjTree.Insert(pBomb, pBombRoot); //activate the sprites SpriteBatch pSB_GameSprites = SpriteBatchManager.Find(SpriteBatch.Name.GameSprites); SpriteBatch pSB_Boxes = SpriteBatchManager.Find(SpriteBatch.Name.SpriteBoxes); pBomb.ActivateGameSprite(pSB_GameSprites); pBomb.ActivateCollisionSprite(pSB_Boxes); }
public override void ToggleVisibility() { SpriteBatch pBoxBatch = SpriteBatchManager.Find(SpriteBatch.Name.Boxes); pBoxBatch.SetDrawBool(true); this.Handle(); }
public static void Remove(SpriteBatch spriteBatch) { Debug.Assert(spriteBatch != null); SpriteBatchManager sbMan = SpriteBatchManager.GetInstance(); sbMan.BaseRemove(spriteBatch); }
// TODO Add a method to reset set pos that takes xy coords public static Missile ActivateMissile() { ShipManager pShipMan = ShipManager.PrivInstance(); Debug.Assert(pShipMan != null); pShipMan.pMissile.SetPos(pShipMan.pShip.x, pShipMan.pShip.y + 20); // Attach to Game Object Manager GameObjectManager.Attach(pShipMan.pMissile); // Attach the sprite to the correct sprite batch SpriteBatch pInvaders = SpriteBatchManager.Find(SpriteBatch.Name.Sprites); pInvaders.Attach(pShipMan.pMissile.pProxySprite); // Attach the spriteBox to the correct sprite batch SpriteBatch pBoxes = SpriteBatchManager.Find(SpriteBatch.Name.Boxes); pBoxes.Attach(pShipMan.pMissile.poColObj.pColSprite); pShipMan.pMissile.GetColObject().enabled = true; pShipMan.pMissile.bMarkForDeath = false; return(pShipMan.pMissile); }
public override void Initialize() { this.poSpriteBatchManager = new SpriteBatchManager(3, 1); SpriteBatchManager.SetActive(this.poSpriteBatchManager); SpriteBatch pSB_Texts = SpriteBatchManager.Add(SpriteBatch.Name.Texts, 4); //--------------------------------------------------------------------------------------------------------- // Create Texts //--------------------------------------------------------------------------------------------------------- this.poFontManager = new FontManager(3, 1); FontManager.SetActive(this.poFontManager); FontManager.Add(Font.Name.TestMessage, SpriteBatch.Name.Texts, "GAME OVER", 300f, SpaceInvaders.ScreenHeight - 350f, 15f, 25f); FontManager.Add(Font.Name.Header, SpriteBatch.Name.Texts, "SCORE<1> HI-SCORE SCORE<2>", 20f, SpaceInvaders.ScreenHeight - 20f, 15f, 25f); FontManager.Add(Font.Name.Player1Score, SpriteBatch.Name.Texts, "0000", 65f, SpaceInvaders.ScreenHeight - 70f, 15f, 25f); FontManager.Add(Font.Name.Player2Score, SpriteBatch.Name.Texts, "0000", SpaceInvaders.ScreenWidth - 156f, SpaceInvaders.ScreenHeight - 70f, 15f, 25f); FontManager.Add(Font.Name.HiScore, SpriteBatch.Name.Texts, "0000", 380f, SpaceInvaders.ScreenHeight - 70f, 15f, 25f); //--------------------------------------------------------------------------------------------------------- // Input //--------------------------------------------------------------------------------------------------------- this.poInputManager = new InputManager(); InputManager.SetActive(this.poInputManager); InputSubject pInputSubject = InputManager.GetSpaceSubject(); pInputSubject.Attach(new SelectPlayObserver()); }
// game methods public override void load() { //--------------------------------------------------------------------------------------------------------- // Create sprite batch //--------------------------------------------------------------------------------------------------------- SpriteBatchManager.getInstance().AddSpriteBatch(SpriteBatch.Name.Player2, 2); //--------------------------------------------------------------------------------------------------------- // Create game sprites //--------------------------------------------------------------------------------------------------------- GameObject alienGrid = GameSpriteFactory.CreateAlienGrid(SpriteBatch.Name.Player2, 50f, 800f); TimerManager.getInstance().Add(new TimerEvent(TimerEvent.Name.ReleaseUFOCommand, new ReleaseUFOCommand(), 0.5f)); // PA6 Create shield ShieldFactory shieldFactory = new ShieldFactory(); GameObject shieldGrid_1 = shieldFactory.CreateShield(SpriteBatch.Name.Player2, 150f, 300f, 15f, 7.5f); GameObject shieldGrid_2 = shieldFactory.CreateShield(SpriteBatch.Name.Player2, 350f, 300f, 15f, 7.5f); GameObject shieldGrid_3 = shieldFactory.CreateShield(SpriteBatch.Name.Player2, 550f, 300f, 15f, 7.5f); GameObject shieldGrid_4 = shieldFactory.CreateShield(SpriteBatch.Name.Player2, 750f, 300f, 15f, 7.5f); // Collision Pair setup ColliPairManager.getInstance().AddCollisionPair(CollisionPair.Name.WallAlien, ProjectileTracker.pLeftWall, alienGrid); ColliPairManager.getInstance().AddCollisionPair(CollisionPair.Name.WallAlien, ProjectileTracker.pRightWall, alienGrid); ColliPairManager.getInstance().AddCollisionPair(CollisionPair.Name.WallMissile, ProjectileTracker.pTopWall, ProjectileTracker.pMissile); ColliPairManager.getInstance().AddCollisionPair(CollisionPair.Name.AlienMissile, alienGrid, ProjectileTracker.pMissile); ColliPairManager.getInstance().AddCollisionPair(CollisionPair.Name.ShieldMissile, shieldGrid_1, ProjectileTracker.pMissile); ColliPairManager.getInstance().AddCollisionPair(CollisionPair.Name.ShieldMissile, shieldGrid_2, ProjectileTracker.pMissile); ColliPairManager.getInstance().AddCollisionPair(CollisionPair.Name.ShieldMissile, shieldGrid_3, ProjectileTracker.pMissile); ColliPairManager.getInstance().AddCollisionPair(CollisionPair.Name.ShieldMissile, shieldGrid_4, ProjectileTracker.pMissile); ColliPairManager.getInstance().AddCollisionPair(CollisionPair.Name.ShieldBomb, shieldGrid_1, ProjectileTracker.pDaggerBomb); ColliPairManager.getInstance().AddCollisionPair(CollisionPair.Name.ShieldBomb, shieldGrid_1, ProjectileTracker.pZigZagBomb); ColliPairManager.getInstance().AddCollisionPair(CollisionPair.Name.ShieldBomb, shieldGrid_1, ProjectileTracker.pRollingBomb); ColliPairManager.getInstance().AddCollisionPair(CollisionPair.Name.ShieldBomb, shieldGrid_2, ProjectileTracker.pDaggerBomb); ColliPairManager.getInstance().AddCollisionPair(CollisionPair.Name.ShieldBomb, shieldGrid_2, ProjectileTracker.pZigZagBomb); ColliPairManager.getInstance().AddCollisionPair(CollisionPair.Name.ShieldBomb, shieldGrid_2, ProjectileTracker.pRollingBomb); ColliPairManager.getInstance().AddCollisionPair(CollisionPair.Name.ShieldBomb, shieldGrid_3, ProjectileTracker.pDaggerBomb); ColliPairManager.getInstance().AddCollisionPair(CollisionPair.Name.ShieldBomb, shieldGrid_3, ProjectileTracker.pZigZagBomb); ColliPairManager.getInstance().AddCollisionPair(CollisionPair.Name.ShieldBomb, shieldGrid_3, ProjectileTracker.pRollingBomb); ColliPairManager.getInstance().AddCollisionPair(CollisionPair.Name.ShieldBomb, shieldGrid_4, ProjectileTracker.pDaggerBomb); ColliPairManager.getInstance().AddCollisionPair(CollisionPair.Name.ShieldBomb, shieldGrid_4, ProjectileTracker.pZigZagBomb); ColliPairManager.getInstance().AddCollisionPair(CollisionPair.Name.ShieldBomb, shieldGrid_4, ProjectileTracker.pRollingBomb); ColliPairManager.getInstance().AddCollisionPair(CollisionPair.Name.WallBomb, ProjectileTracker.pBottomWall, ProjectileTracker.pDaggerBomb); ColliPairManager.getInstance().AddCollisionPair(CollisionPair.Name.WallBomb, ProjectileTracker.pBottomWall, ProjectileTracker.pZigZagBomb); ColliPairManager.getInstance().AddCollisionPair(CollisionPair.Name.WallBomb, ProjectileTracker.pBottomWall, ProjectileTracker.pRollingBomb); ColliPairManager.getInstance().AddCollisionPair(CollisionPair.Name.MissileBomb, ProjectileTracker.pMissile, ProjectileTracker.pDaggerBomb); ColliPairManager.getInstance().AddCollisionPair(CollisionPair.Name.MissileBomb, ProjectileTracker.pMissile, ProjectileTracker.pZigZagBomb); ColliPairManager.getInstance().AddCollisionPair(CollisionPair.Name.MissileBomb, ProjectileTracker.pMissile, ProjectileTracker.pRollingBomb); ColliPairManager.getInstance().AddCollisionPair(CollisionPair.Name.ShipBomb, ProjectileTracker.pShip, ProjectileTracker.pDaggerBomb); ColliPairManager.getInstance().AddCollisionPair(CollisionPair.Name.ShipBomb, ProjectileTracker.pShip, ProjectileTracker.pZigZagBomb); ColliPairManager.getInstance().AddCollisionPair(CollisionPair.Name.ShipBomb, ProjectileTracker.pShip, ProjectileTracker.pRollingBomb); ColliPairManager.getInstance().AddCollisionPair(CollisionPair.Name.UFOMissile, ProjectileTracker.pUFO, ProjectileTracker.pMissile); }
public override void update() { // update score bar SpriteBatchManager.getInstance().FindSpriteBatchByName(SpriteBatch.Name.ScoreBar).UpdateAllNodes(); // update current scene SpriteBatchManager.getInstance().FindSpriteBatchByName(SpriteBatch.Name.GameOver).UpdateAllNodes(); }
public override void draw() { SpriteBatchManager.draw(); Sprite crab = SpriteManager.find(Sprite.SpriteName.Crab); crab.x = 300; crab.y = 700; crab.update(); crab.render(); Sprite squid = SpriteManager.find(Sprite.SpriteName.Squid); squid.x = 300; squid.y = 640; squid.update(); squid.render(); Sprite octopus = SpriteManager.find(Sprite.SpriteName.Octopus); octopus.x = 300; octopus.y = 560; octopus.update(); octopus.render(); Sprite ufo = SpriteManager.find(Sprite.SpriteName.AlienUFO); ufo.x = 300; ufo.y = 500; ufo.update(); ufo.render(); }
public BombFactory(SpriteBatchName sbName, PCSTree tree) { this.pSpriteBatch = SpriteBatchManager.Find(sbName); Debug.Assert(this.pSpriteBatch != null); this.pTree = tree; Debug.Assert(this.pTree != null); }
public static void DisplayLives(int numLives) { ClearLives(); Debug.Assert(numLives >= 0 && numLives <= 3); SpriteBatch pSpriteBatch = SpriteBatchManager.Find(SpriteBatch.Name.Texts); Debug.Assert(pSpriteBatch != null); LivesManager pMan = PrivGetInstance(); if (numLives > 0) { pSpriteBatch.Attach(pMan.pShip1); } if (numLives > 1) { pSpriteBatch.Attach(pMan.pShip2); } if (numLives > 2) { pSpriteBatch.Attach(pMan.pShip3); } pMan.numLives = numLives; Font pLives = FontManager.Find(Font.Name.Lives); pLives.UpdateMessage(numLives.ToString()); }
public override void Update() { GameObject gameObjectA = this.pSubject.goA; GameObject gameObjectB = this.pSubject.goB; GameObject go = Missile.GetNonMissile(gameObjectA, gameObjectB); ColorName pColorName = ColorName.White; if (go.gameObjectName == GameObjectName.Bomb) { pColorName = ColorName.Orange; } else if (go.gameObjectName == GameObjectName.UFO) { pColorName = ColorName.Red; } else if (go.gameObjectName == GameObjectName.UFOBomb) { pColorName = ColorName.Yellow; } Alien pExplosion = new Explosion(GameObjectName.Splat, SpriteBaseName.Splat, AlienType.Splat, gameObjectB, pColorName, 0); SpriteBatch sbAliens = SpriteBatchManager.Find(SpriteBatchName.Aliens); SpriteBatch sbBoxes = SpriteBatchManager.Find(SpriteBatchName.Boxes); pExplosion.ActivateGameSprite(sbAliens); pExplosion.ActivateCollisionSprite(sbBoxes); GameObjectManager.AttachTree(pExplosion); TimerManager.Add(TimerEventName.RemoveGameObject, TimerManager.GetCurrentTime(), TimerManager.GetCurrentTime(), new RemoveGameObjectCommand(pExplosion)); }
public static void ActivateGrid(InvaderGrid pGrid, SpriteBatch.Name spriteBatchName, SpriteBatch.Name boxSpriteBatchName) { Debug.Assert(pGrid != null); GameObjectManager.Attach(pGrid); SpriteBatch pSpriteBatch = SpriteBatchManager.Find(spriteBatchName); Debug.Assert(pSpriteBatch != null); SpriteBatch pBoxSpriteBatch = SpriteBatchManager.Find(boxSpriteBatchName); Debug.Assert(pBoxSpriteBatch != null); pBoxSpriteBatch.Attach(pGrid.poColObj.pColSprite); pSpriteBatch.Attach(pGrid.pProxySprite); ForwardIterator pFwdItor = new ForwardIterator(pGrid); GameObject pGameObj = (GameObject)pFwdItor.Next(); while (!pFwdItor.IsDone()) { GameObjectManager.Attach(pGameObj); pBoxSpriteBatch.Attach(pGameObj.poColObj.pColSprite); pSpriteBatch.Attach(pGameObj.pProxySprite); pGameObj = (GameObject)pFwdItor.Next(); } }
public static void Create(int reserveSize = 3, int reserveIncrement = 1) { if (pInstance == null) { pInstance = new SpriteBatchManager(reserveSize, reserveIncrement); } }
// MUST CALL THIS WHEN GAME STARTS public static void initialize(int toCreate, int willCreate) { Debug.Assert(toCreate > 0); Debug.Assert(willCreate > 0); if (iSBMan == null) { iSBMan = new SpriteBatchManager(toCreate, willCreate); } }
public Player(PlayerNum type = PlayerNum.One) { batchMan = new SpriteBatchManager(9, 1); gameObjMan = new GameObjectManager(11, 1); timeMan = new TimeEventManager(4, 2); colPairMan = new CollisionPairManager(13, 1); hookupManagers(); initialPlayerSetup(); playerType = type; currNumLives = maxLives; }
public static void setInstance(SpriteBatchManager instance) { iSBMan = instance; }