public GameObject Create(GameObject.Name name, float posX = 0.0f, float posY = 0.0f) { GameObject pGameObj = null; switch (name) { case GameObject.Name.PurpleOctopus: pGameObj = new PurpleOctopus(GameObject.Name.PurpleOctopus, GameSprite.Name.PurpleOctopus, posX, posY); break; case GameObject.Name.BlueCrab: pGameObj = new BlueCrab(GameObject.Name.BlueCrab, GameSprite.Name.BlueCrab, posX, posY); break; case GameObject.Name.GreenSquid: pGameObj = new GreenSquid(GameObject.Name.GreenSquid, GameSprite.Name.GreenSquid, posX, posY); break; case GameObject.Name.OrangeSaucer: pGameObj = new OrangeSaucer(GameObject.Name.OrangeSaucer, GameSprite.Name.OrangeSaucer, posX, posY); break; case GameObject.Name.AlienColumn: pGameObj = new AlienColumn(GameObject.Name.AlienColumn, GameSprite.Name.NullObject, 0.0f, 0.0f); break; case GameObject.Name.AlienGrid: pGameObj = new AlienGrid(GameObject.Name.AlienGrid, GameSprite.Name.NullObject, 0.0f, 0.0f); break; default: // something is wrong Debug.Assert(false); break; } Debug.Assert(pGameObj != null); // Attached to Group pGameObj.ActivateGameSprite(this.pSpriteBatch); pGameObj.ActivateCollisionSprite(this.pCollisionSpriteBatch); return(pGameObj); }
public virtual void VisitGreenSquid(GreenSquid b) { // no differed to subcass Debug.WriteLine("Visit by GreenSquid not implemented"); Debug.Assert(false); }
public override void Initialize() { //--------------------------------------------------------------------------------------------------------- // Create SpriteBatch //--------------------------------------------------------------------------------------------------------- this.poSpriteBatchManager = new SpriteBatchManager(3, 1); SpriteBatchManager.SetActive(this.poSpriteBatchManager); SpriteBatch pSB_Texts = SpriteBatchManager.Add(SpriteBatch.Name.Texts, 4); SpriteBatch pSB_Aliens = SpriteBatchManager.Add(SpriteBatch.Name.Aliens, 1); //--------------------------------------------------------------------------------------------------------- // Game Objects //--------------------------------------------------------------------------------------------------------- OrangeSaucer pSaucer = new OrangeSaucer(GameObject.Name.Null_Object, GameSprite.Name.OrangeSaucer, 325, SpaceInvaders.ScreenHeight - 575f); pSaucer.ActivateGameSprite(pSB_Aliens); GreenSquid pSquid = new GreenSquid(GameObject.Name.Null_Object, GameSprite.Name.GreenSquid, 325, SpaceInvaders.ScreenHeight - 650f); pSquid.ActivateGameSprite(pSB_Aliens); BlueCrab pCrab = new BlueCrab(GameObject.Name.Null_Object, GameSprite.Name.BlueCrab, 325, SpaceInvaders.ScreenHeight - 725f); pCrab.ActivateGameSprite(pSB_Aliens); PurpleOctopus pOcto = new PurpleOctopus(GameObject.Name.Null_Object, GameSprite.Name.PurpleOctopus, 325, SpaceInvaders.ScreenHeight - 800f); pOcto.ActivateGameSprite(pSB_Aliens); //--------------------------------------------------------------------------------------------------------- // Create Texts //--------------------------------------------------------------------------------------------------------- this.poFontManager = new FontManager(3, 1); FontManager.SetActive(this.poFontManager); FontManager.Add(Font.Name.TestMessage, SpriteBatch.Name.Texts, "PLAY", 380f, SpaceInvaders.ScreenHeight - 250f, 15f, 25f); FontManager.Add(Font.Name.TestMessage, SpriteBatch.Name.Texts, "SPACE INVADERS", 255f, SpaceInvaders.ScreenHeight - 350f, 15f, 25f); FontManager.Add(Font.Name.TestMessage, SpriteBatch.Name.Texts, "*SCORE ADVANCE TABLE*", 200f, SpaceInvaders.ScreenHeight - 500f, 15f, 25f); FontManager.Add(Font.Name.TestMessage, SpriteBatch.Name.Texts, "=? MYSTERY", 350f, SpaceInvaders.ScreenHeight - 575f, 15f, 25f); FontManager.Add(Font.Name.TestMessage, SpriteBatch.Name.Texts, "=30 POINTS", 350f, SpaceInvaders.ScreenHeight - 650f, 15f, 25f); FontManager.Add(Font.Name.TestMessage, SpriteBatch.Name.Texts, "=20 POINTS", 350f, SpaceInvaders.ScreenHeight - 725f, 15f, 25f); FontManager.Add(Font.Name.TestMessage, SpriteBatch.Name.Texts, "=10 POINTS", 350f, SpaceInvaders.ScreenHeight - 800f, 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.HiScore, SpriteBatch.Name.Texts, "0000 0000 0000", 65f, SpaceInvaders.ScreenHeight - 70f, 15f, 25f); //--------------------------------------------------------------------------------------------------------- // Input //--------------------------------------------------------------------------------------------------------- this.poInputManager = new InputManager(); InputManager.SetActive(this.poInputManager); InputSubject pInputSubject = InputManager.GetSpaceSubject(); pInputSubject.Attach(new SelectPlayObserver()); }