コード例 #1
0
        public GameObject Create(GameObject.Name name, AlienCategory.Type type, float posX = 0.0f, float posY = 0.0f)
        {
            GameObject pGameObj = null;

            switch (type)
            {
            case AlienCategory.Type.Squid:
                pGameObj = new SquidAlien(name, GameSprite.Name.SquidOpen, posX, posY);
                break;

            case AlienCategory.Type.Crab:
                pGameObj = new CrabAlien(name, GameSprite.Name.CrabOpen, posX, posY);
                break;

            case AlienCategory.Type.Octopus:
                pGameObj = new OctopusAlien(name, GameSprite.Name.OctopusOpen, posX, posY);
                break;

            case AlienCategory.Type.Grid:
                pGameObj = new AlienGrid(name, GameSprite.Name.NullObject, 0.0f, 0.0f);
                break;

            case AlienCategory.Type.Column:
                pGameObj = new AlienColumn(name, GameSprite.Name.NullObject, 0.0f, 0.0f);
                break;

            default:
                // something is wrong
                Debug.Assert(false);
                break;
            }

            // add it to the gameObjectManager
            Debug.Assert(pGameObj != null);
            //GameObjectMan.Attach(pGameObj);

            // Attached to Group
            pGameObj.ActivateGameSprite(this.pSpriteBatch);
            pGameObj.ActivateCollisionSprite(this.pCollisionSpriteBatch);

            return(pGameObj);
        }
コード例 #2
0
        public void Create(Alien.Type type, float posX, float posY)
        {
            GameObject pGameObj = null;

            switch (type)
            {
            case Alien.Type.Crab:
                pGameObj = new CrabAlien(GameObject.Name.CrabAlien, Sprite.Name.CrabAlien, posX, posY);
                break;

            case Alien.Type.FlyingSaucer:
                pGameObj = new FlyingSaucer(GameObject.Name.FlyingSaucer, Sprite.Name.FlyingSaucer, posX, posY);
                break;

            case Alien.Type.JellyFish:
                pGameObj = new JellyfishAlien(GameObject.Name.JellyFishAlien, Sprite.Name.JellyfishAlien, posX, posY);
                break;

            case Alien.Type.Squid:
                pGameObj = new SquidAlien(GameObject.Name.SquidAlien, Sprite.Name.SquidAlien, posX, posY);
                break;

            default:
                // something is wrong
                Debug.Assert(false);
                break;
            }

            // Add to GameObjectManager
            Debug.Assert(pGameObj != null);
            GameStateManager.GetGame().GetStateGameObjectManager().Attach(pGameObj);

            // Add to Composite
            pComposite.Add(pGameObj);

            // Attach to SpriteBatch
            pGameObj.ActivateSprite(this.pAlienSpriteBatch);
            pGameObj.ActivateCollisionSprite(this.pCollisionBoxSpriteBatch);
        }
コード例 #3
0
        public override void LoadContent()
        {
            // Set to current state for initialization
            GameStateManager.GetGame().SetGameState(GameStateManager.GameState.Attract);

            //---------------------------------------------------------------------------------------------------------
            // Initialize State-Scoped Managers
            //---------------------------------------------------------------------------------------------------------

            this.pSpriteBatchManager     = new SpriteBatchManager(3, 1);
            this.pGameObjectManager      = new GameObjectManager(10, 5);
            this.pQueuedTimeEventManager = new QueuedTimeEventManager(20, 5);
            this.pDelayedObjectManager   = new DelayedObjectManager();

            //---------------------------------------------------------------------------------------------------------
            // Create Colors
            //---------------------------------------------------------------------------------------------------------

            //pGreenColor = new Azul.Color(0.1137f, 0.8196f, 0.2667f, 1.0f);

            //---------------------------------------------------------------------------------------------------------
            // Create SpriteBatches
            //---------------------------------------------------------------------------------------------------------
            SpriteBatch pTexts_SpriteBatch = this.pSpriteBatchManager.Add(SpriteBatch.Name.AttractTexts);
            SpriteBatch pAlien_SpriteBatch = this.pSpriteBatchManager.Add(SpriteBatch.Name.Attract_Aliens);

            //---------------------------------------------------------------------------------------------------------
            // Aliens
            //---------------------------------------------------------------------------------------------------------
            FlyingSaucer pFlyingSaucer = new FlyingSaucer(GameObject.Name.FlyingSaucer, Sprite.Name.FlyingSaucer, 300, 400);

            this.pGameObjectManager.Attach(pFlyingSaucer);
            pFlyingSaucer.ActivateSprite(pAlien_SpriteBatch);

            SquidAlien pSquidAlien = new SquidAlien(GameObject.Name.SquidAlien, Sprite.Name.SquidAlien, 300, 350);

            this.pGameObjectManager.Attach(pSquidAlien);
            pSquidAlien.ActivateSprite(pAlien_SpriteBatch);

            CrabAlien pCrabAlien = new CrabAlien(GameObject.Name.CrabAlien, Sprite.Name.CrabAlien, 300, 300);

            this.pGameObjectManager.Attach(pCrabAlien);
            pCrabAlien.ActivateSprite(pAlien_SpriteBatch);

            JellyfishAlien pJellyfishAlien = new JellyfishAlien(GameObject.Name.JellyFishAlien, Sprite.Name.JellyfishAlien, 300, 250);

            this.pGameObjectManager.Attach(pJellyfishAlien);
            pJellyfishAlien.ActivateSprite(pAlien_SpriteBatch);

            //---------------------------------------------------------------------------------------------------------
            // Fonts
            //---------------------------------------------------------------------------------------------------------
            FontManager.Add(Font.Name.Attract_Play, pTexts_SpriteBatch, "PLAY", Glyph.Name.Consolas36pt, 385, 650);
            FontManager.Add(Font.Name.Attract_Title, pTexts_SpriteBatch, "SPACE INVADERS", Glyph.Name.Consolas36pt, 290, 550);
            FontManager.Add(Font.Name.Attract_ScoreAdvanceTable, pTexts_SpriteBatch, "* SCORE ADVANCE TABLE *", Glyph.Name.Consolas36pt, 225, 450);
            FontManager.Add(Font.Name.Attract_FlyingSaucerPoints, pTexts_SpriteBatch, "= ?  MYSTERY", Glyph.Name.Consolas36pt, 350, 400);
            FontManager.Add(Font.Name.Attract_SquidPoints, pTexts_SpriteBatch, "= 30  POINTS", Glyph.Name.Consolas36pt, 350, 350);
            FontManager.Add(Font.Name.Attract_CrabPoints, pTexts_SpriteBatch, "= 20  POINTS", Glyph.Name.Consolas36pt, 350, 300);
            FontManager.Add(Font.Name.Attract_JellyfishPoints, pTexts_SpriteBatch, "= 10  POINTS", Glyph.Name.Consolas36pt, 350, 250);

            FontManager.Add(Font.Name.Attract_Instruction_1P, pTexts_SpriteBatch, "PRESS 1 FOR 1-PLAYER MODE", Glyph.Name.Consolas36pt, 200, 150);
            FontManager.Add(Font.Name.Attract_Instruction_2P, pTexts_SpriteBatch, "PRESS 2 FOR 2-PLAYER MODE", Glyph.Name.Consolas36pt, 200, 115);
        }
コード例 #4
0
 public virtual void VisitSquidAlien(SquidAlien s)
 {
     // no differed to subcass
     Debug.WriteLine("Visit by SquidAlien not implemented");
     Debug.Assert(false);
 }