Exemplo n.º 1
0
        public override void VisitSquid(Squid a)
        {
            ColPair pColPair = ColPairMan.GetActiveColPair();

            pColPair.SetCollision(this, a);
            pColPair.NotifyListeners();
        }
Exemplo n.º 2
0
        public override void Draw(Game pGame)
        {
            FontManager.DrawString("PLAY", 400.0f, 800.0f);
            FontManager.DrawString("SPACE INVADERS", 320.0f, 700.0f);
            FontManager.DrawString("*SCORE ADVANCE TABLE*", 250.0F, 500.0f);
            FontManager.DrawString("= ??? MYSTERY", 380.0f, 440.0f);
            FontManager.DrawString("= 30 POINTS", 380.0f, 365.0f);
            FontManager.DrawString("= 20 POINTS", 380.0f, 290.0f);
            FontManager.DrawString("= 10 POINTS", 380.0f, 215.0f);
            Alien pUFO = new UFO(GameObjectName.UFO, SpriteBaseName.UFO, null, 325.0f, 440.0f);

            pUFO.pProxySprite.x = 325.0f;
            pUFO.pProxySprite.y = 440.0f;
            pUFO.pProxySprite.Render();
            pUFO.pProxySprite.Update();
            Alien pSquid = new Squid(GameObjectName.Squid, SpriteBaseName.Squid, 325.0f, 375.0f, 0);

            pSquid.pProxySprite.x = 325.0f;
            pSquid.pProxySprite.y = 375.0f;
            pSquid.pProxySprite.Render();
            pSquid.pProxySprite.Update();
            Alien pCrab = new Crab(GameObjectName.Crab, SpriteBaseName.Crab, 325.0f, 300.0f, 0);

            pCrab.pProxySprite.x = 325.0f;
            pCrab.pProxySprite.y = 300.0f;
            pCrab.pProxySprite.Render();
            pCrab.pProxySprite.Update();
            Alien pOctopus = new Octopus(GameObjectName.Octopus, SpriteBaseName.Octopus, 325.0f, 225.0f, 0);

            pOctopus.pProxySprite.x = 325.0f;
            pOctopus.pProxySprite.y = 225.0f;
            pOctopus.pProxySprite.Render();
            pOctopus.pProxySprite.Update();
        }
Exemplo n.º 3
0
 private static Squid create(Squid.SquidName name, Index index, float x, float y)
 {
     Squid squid = new Squid(GameObject.Name.Grid, SpriteEnum.Squid, index, x, y);
     Debug.Assert(squid.Spr != null);
     Instance.batch.attach(squid.Spr);
     SpriteBatchManager.attachToGroup(squid.ColObj.Spr, BatchGroup.BatchType.Collisions);
     GameObjectManager.insert(squid, Instance.cols);
     return squid;
 }
Exemplo n.º 4
0
        public override void loadContent(Scene pScene)
        {
            SpriteBatchMan.Add(SpriteBatch.Name.SelectWindowTexts);

            FontMan.Add(Font.Name.Texts, SpriteBatch.Name.SelectWindowTexts, "SCORE<1>", Glyph.Name.Consolas36pt, 20, 1000);
            FontMan.Add(Font.Name.Texts, SpriteBatch.Name.SelectWindowTexts, "HI-SCORE", Glyph.Name.Consolas36pt, 370, 1000);
            FontMan.Add(Font.Name.Texts, SpriteBatch.Name.SelectWindowTexts, "SCORE<2>", Glyph.Name.Consolas36pt, 700, 1000);
            FontMan.Add(Font.Name.ScoreOne, SpriteBatch.Name.SelectWindowTexts, pScene.getScoreOne().ToString("D4"), Glyph.Name.Consolas36pt, 50, 960);
            FontMan.Add(Font.Name.HighestScore, SpriteBatch.Name.SelectWindowTexts, pScene.getHighestScore().ToString("D4"), Glyph.Name.Consolas36pt, 400, 960);
            FontMan.Add(Font.Name.ScoreTwo, SpriteBatch.Name.SelectWindowTexts, pScene.getScoreTwo().ToString("D4"), Glyph.Name.Consolas36pt, 730, 960);
            FontMan.Add(Font.Name.Texts, SpriteBatch.Name.SelectWindowTexts, "CREDIT", Glyph.Name.Consolas36pt, 700, 25);
            FontMan.Add(Font.Name.Texts, SpriteBatch.Name.SelectWindowTexts, "00", Glyph.Name.Consolas36pt, 830, 25);
            FontMan.Add(Font.Name.Texts, SpriteBatch.Name.SelectWindowTexts, "SPACE    INVADERS", Glyph.Name.Consolas36pt, 300, 750);
            FontMan.Add(Font.Name.Texts, SpriteBatch.Name.SelectWindowTexts, "PUSH <1> OR <2> PLAYERS BUTTON", Glyph.Name.Consolas36pt, 160, 700);
            FontMan.Add(Font.Name.Texts, SpriteBatch.Name.SelectWindowTexts, "*SCORE  ADVANCE  TABLE*", Glyph.Name.Consolas36pt, 240, 650);
            FontMan.Add(Font.Name.Texts, SpriteBatch.Name.SelectWindowTexts, "= 200 POINTS", Glyph.Name.Consolas36pt, 380, 600);
            FontMan.Add(Font.Name.Texts, SpriteBatch.Name.SelectWindowTexts, "= 30 POINTS", Glyph.Name.Consolas36pt, 380, 550);
            FontMan.Add(Font.Name.Texts, SpriteBatch.Name.SelectWindowTexts, "= 20 POINTS", Glyph.Name.Consolas36pt, 380, 500);
            FontMan.Add(Font.Name.Texts, SpriteBatch.Name.SelectWindowTexts, "= 10 POINTS", Glyph.Name.Consolas36pt, 380, 450);

            SpriteBatch   pSB_StartWindowSprites = SpriteBatchMan.Add(SpriteBatch.Name.StartWindowSprites);
            ShipLifeGroup pStartWindow           = new ShipLifeGroup(GameObject.Name.ShipLifeGroup, GameSprite.Name.NullObject, 0.0f, 0.0f);

            pStartWindow.activateGameSprite(pSB_StartWindowSprites);

            UFO pUFO = new UFO(GameObject.Name.UFO, GameSprite.Name.UFO, 320, 600, true);

            pUFO.activateGameSprite(pSB_StartWindowSprites);
            pStartWindow.add(pUFO);

            Squid pSquid = new Squid(GameObject.Name.Squid, GameSprite.Name.Squid, 320, 550);

            pSquid.activateGameSprite(pSB_StartWindowSprites);
            pStartWindow.add(pSquid);

            Crab pCrab = new Crab(GameObject.Name.Crab, GameSprite.Name.Crab, 320, 500);

            pCrab.activateGameSprite(pSB_StartWindowSprites);
            pStartWindow.add(pCrab);

            Octopus pOctopus = new Octopus(GameObject.Name.Octopus, GameSprite.Name.Octopus, 320, 450);

            pOctopus.activateGameSprite(pSB_StartWindowSprites);
            pStartWindow.add(pOctopus);

            GameObjectMan.Attach(pStartWindow);

            InputSubject pInputSubject;

            pInputSubject = InputMan.GetKey1Subject();
            pInputSubject.attach(new OnePlayerObserver());

            pInputSubject = InputMan.GetKey2Subject();
            pInputSubject.attach(new TwoPlayerObserver());
        }
Exemplo n.º 5
0
        public override void visitSquid(Squid a)
        {
            Debug.WriteLine("StraightMissile Squid");
            Debug.WriteLine("Both tress finished to roots");

            CollisionPair currColPair = CollisionPairManager.getCurrentColPair();

            Debug.Assert(currColPair != null);
            currColPair.setSubject(a, this);
            currColPair.notifyObserver();
        }
Exemplo n.º 6
0
        public AlienType Create(AlienType.Type type, GameObject.Name gameObjectName, int index = 0, float posX = 0.0f, float posY = 0.0f)
        {
            AlienType pAlien = null;

            switch (type)
            {
            case AlienType.Type.Crab:
                pAlien = new Crab(gameObjectName, GameSprite.Name.Crab, index, posX, posY);
                break;

            case AlienType.Type.Squid:
                pAlien = new Squid(gameObjectName, GameSprite.Name.Squid, index, posX, posY);
                break;

            case AlienType.Type.Octopus:
                pAlien = new Octopus(gameObjectName, GameSprite.Name.Octopus, index, posX, posY);
                break;


            case AlienType.Type.AlienGrid:
                //note that the grid HAS a sprite to determine color of the sprite box
                //it will not render a sprite since the image is a null image object
                pAlien = new Grid(gameObjectName, GameSprite.Name.AlienGrid, index, posX, posY);
                //GameObjectManager.AttachTree(pAlien);
                //todo refactor GridManager to handle at least two grids;
                GridManager.CreateGridManager((Grid)pAlien);
                break;

            case AlienType.Type.AlienGridColumn:
                pAlien = new Column(gameObjectName, GameSprite.Name.AlienColumn, index, posX, posY);
                break;

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


            //insert alien into the PCSTree Hierarchy;
            this.pTree.Insert(pAlien, this.pParent);

            //Activate the GameSprite by attaching the
            //new alien's proxy sprite to the alien sprite batch;
            //also attach a collision box associated with this sprite;
            pAlien.ActivateGameSprite(this.pSpriteBatch);
            pAlien.ActivateCollisionSprite(this.pSpriteBatch);

            return(pAlien);
        }
Exemplo n.º 7
0
        public GameObject Create(GameObject.Name name, AlienCategory.Type type, GameObject pContainer = null, float posX = 0.0f, float posY = 0.0f)
        {
            GameObject pGameObj = null;

            switch (type)
            {
            case AlienCategory.Type.Squid:
                pGameObj = new Squid(GameObject.Name.Squid, GameSprite.Name.Squid, posX, posY);
                AlienCategory pAlienCategory = (AlienCategory)pGameObj;
                pAlienCategory.SetState(AlienMan.State.Ready);
                break;

            case AlienCategory.Type.Crab:
                pGameObj       = new Crab(GameObject.Name.Crab, GameSprite.Name.Crab, posX, posY);
                pAlienCategory = (AlienCategory)pGameObj;
                pAlienCategory.SetState(AlienMan.State.Ready);
                break;

            case AlienCategory.Type.Octopus:
                pGameObj       = new Octopus(GameObject.Name.Octopus, GameSprite.Name.Octopus, posX, posY);
                pAlienCategory = (AlienCategory)pGameObj;
                pAlienCategory.SetState(AlienMan.State.Ready);
                break;

            case AlienCategory.Type.Group:
                pGameObj = new AlienGroup(name, GameSprite.Name.NullObject, posX, posY);
                break;

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

            default:
                Debug.Assert(false);
                break;
            }

            // Attached to Group
            this.AttachTo(pGameObj, pContainer);
            return(pGameObj);
        }
Exemplo n.º 8
0
        public GameObject Create(AlienCategory.Type type, GameObject.Name gameName, float posX = 0.0f, float posY = 0.0f)
        {
            GameObject pAlien = null;

            switch (type)
            {
            case AlienCategory.Type.Squid:
                pAlien = new Squid(gameName, GameSprite.Name.Squid, posX, posY);
                break;

            case AlienCategory.Type.Crab:
                pAlien = new Crab(gameName, GameSprite.Name.Crab, posX, posY);
                break;

            case AlienCategory.Type.Octopus:
                pAlien = new Octopus(gameName, GameSprite.Name.Octopus, posX, posY);
                break;

            case AlienCategory.Type.AlienColumn:
                pAlien = new AlienColumn(gameName, GameSprite.Name.NullObject, posX, posY);
                break;

            case AlienCategory.Type.AlienGrid:
                pAlien = new AlienGrid(gameName, GameSprite.Name.NullObject, posX, posY);
                break;

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

            // add to the tree
            this.pTree.Add(pAlien);

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

            return(pAlien);
        }
Exemplo n.º 9
0
        public Alien createAlien(Alien.AlienType mAlienType, GameObject.GameObjectName gameName, int index = 0, float mX = 0.0f, float mY = 0.0f)
        {
            Alien alien = null;

            switch (mAlienType)
            {
            case Alien.AlienType.Crab:
                alien = new Crab(gameName, Sprite.SpriteName.Crab, index, mX, mY);
                break;

            case Alien.AlienType.Squid:
                alien = new Squid(gameName, Sprite.SpriteName.Squid, index, mX, mY);
                break;

            case Alien.AlienType.Octopus:
                alien = new Octopus(gameName, Sprite.SpriteName.Octopus, index, mX, mY);
                break;

            case Alien.AlienType.Column:
                alien = new Column(gameName, Sprite.SpriteName.NullObject, index, mX, mY);
                //  columnCount++;
                //  Debug.WriteLine(columnCount);
                break;

            case Alien.AlienType.AlienGrid:
                alien = new AlienGrid(gameName, Sprite.SpriteName.NullObject, index, mX, mY);
                GameObjectNodeManager.add(alien, cPCSTree);
                break;

            case Alien.AlienType.AlienExplosion:
                alien = new AlienExplode(gameName, Sprite.SpriteName.AlienExplosion, index, mX, mY);
                break;

            case Alien.AlienType.Uninitilized:
                Debug.WriteLine("Alien Type is Uninitilized");
                break;
            }

            activate(alien);
            return(alien);
        }
Exemplo n.º 10
0
        public Alien Create(AlienType alienType, float x, float y)
        {
            Alien pAlien = null;

            switch (alienType)
            {
            case AlienType.Crab:
                pAlien = new Crab(GameObjectName.Crab, SpriteBaseName.Crab, x, y);
                break;

            case AlienType.Squid:
                pAlien = new Squid(GameObjectName.Squid, SpriteBaseName.Squid, x, y);
                break;

            case AlienType.Octopus:
                pAlien = new Octopus(GameObjectName.Octopus, SpriteBaseName.Octopus, x, y);
                break;

            case AlienType.Hierarchy:
                pAlien = new Grid();
                break;

            case AlienType.Ship:
                pAlien = new Ship(GameObjectName.Ship, SpriteBaseName.Ship, x, y);
                break;

            default:
                Debug.Assert(pAlien != null);
                break;
            }
            GameObjectManager.Add(pAlien);
            //this.pTree.dumpTree();
            if (alienType != AlienType.Ship)
            {
                this.pTree.Insert(pAlien, this.pParent);
            }
            //this.pTree.dumpTree();
            this.pSpriteBatch.Attach(pAlien.pProxySprite);
            this.pSpriteBoxBatch.Attach(pAlien.pCollisionObject.pCollisionSpriteBox);
            return(pAlien);
        }
Exemplo n.º 11
0
        //-------------------------------------------------------------------------------
        // Methods
        //-------------------------------------------------------------------------------
        public GameObject create(GameObject.Name objectName, AlienCategory.Type alienType, float posX = 0.0f, float posY = 0.0f)
        {
            GameObject pGameObject = null;

            switch (alienType)
            {
            case AlienCategory.Type.Octopus:
                pGameObject = new Octopus(objectName, GameSprite.Name.Octopus, posX, posY);
                break;

            case AlienCategory.Type.Crab:
                pGameObject = new Crab(objectName, GameSprite.Name.Crab, posX, posY);
                break;

            case AlienCategory.Type.Squid:
                pGameObject = new Squid(objectName, GameSprite.Name.Squid, posX, posY);
                break;

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

            case AlienCategory.Type.Group:
                pGameObject = new AlienGroup(objectName, GameSprite.Name.NullObject, 0.0f, 0.0f);
                break;

            default:
                Debug.Assert(false);
                break;
            }

            // add pGameObject to GameObjectMan and pGrid
            Debug.Assert(pGameObject != null);

            // attached to SpritBatch
            pGameObject.activateGameSprite(this.pSpriteBatch);
            pGameObject.activateCollisionSprite(this.pBoxSpriteBatch);

            return(pGameObject);
        }
Exemplo n.º 12
0
        public Alien Create(AlienType alienType, GameObjectName goName, int goIdx = 0, float x = 0.0f, float y = 0.0f)
        {
            Alien pAlien = null;

            switch (alienType)
            {
            case AlienType.Crab:
                pAlien = new Crab(goName, SpriteBaseName.Crab, x, y, goIdx);
                break;

            case AlienType.Squid:
                pAlien = new Squid(goName, SpriteBaseName.Squid, x, y, goIdx);
                break;

            case AlienType.Octopus:
                pAlien = new Octopus(goName, SpriteBaseName.Octopus, x, y, goIdx);
                break;

            case AlienType.Grid:
                pAlien = new Grid(goName, SpriteBaseName.Null, x, y, goIdx);
                GameObjectManager.AttachTree(pAlien);
                break;

            case AlienType.Column:
                pAlien = new Column(goName, SpriteBaseName.Null, x, y, goIdx, this.pRandom);
                break;

            default:
                Debug.Assert(pAlien != null);
                break;
            }
            this.pTree.Insert(pAlien, this.pParent);
            pAlien.ActivateGameSprite(this.pSpriteBatch);
            pAlien.ActivateCollisionSprite(this.pSpriteBatch);
            return(pAlien);
        }
Exemplo n.º 13
0
 //-------------------------------------
 public virtual void VisitSquid(Squid a)
 {
     // no differed to subcass
     Debug.WriteLine("Visit by Squid not implemented");
     Debug.Assert(false);
 }
Exemplo n.º 14
0
 public virtual void VisitSquid(Squid pSquid)
 {
     Debug.WriteLine("Visit by Squid not implemented.");
     Debug.Assert(false);
 }
 public virtual void visitSquid(Squid a)
 {
 }
Exemplo n.º 16
0
        // strategy()
        override public void LoadContent()
        {
            SpriteBatchMan.Create(3, 1);
            TextureMan.Create(2, 1);
            GlyphMan.Create(3, 1);
            FontMan.Create(1, 1);
            ImageMan.Create(5, 2);
            GameSpriteMan.Create(4, 2);
            ProxySpriteMan.Create(10, 1);
            BoxSpriteMan.Create(3, 1);
            GameObjectMan.Create(3, 1);
            GhostGameObjectMan.Create(3, 1);

            //ImageMan.Create(5, 2);
            //GameSpriteMan.Create(4, 2);
            //ImageMan.Create(5, 2);
            //GameSpriteMan.Create(4, 2);
            //GameObjectMan.Create(3, 1);
            //ProxySpriteMan.Create(10, 1);


            TextureMan.Add(Texture.Name.Aliens, "newaliens.tga");
            Texture pTexture = TextureMan.Add(Texture.Name.Consolas20pt, "Consolas20pt.tga");

            FontMan.AddXml(Glyph.Name.Consolas20pt, "Consolas20pt.xml", Texture.Name.Consolas20pt);

            SpriteBatch pSB_Texts  = SpriteBatchMan.Add(SpriteBatch.Name.Texts);
            SpriteBatch pSB_Aliens = SpriteBatchMan.Add(SpriteBatch.Name.Aliens);

            // Font
            FontMan.Add(Font.Name.TestMessage, SpriteBatch.Name.Texts, "SCORE<1>", Glyph.Name.Consolas20pt, 100, 730);
            FontMan.Add(Font.Name.TestMessage, SpriteBatch.Name.Texts, "HI-SCORE", Glyph.Name.Consolas20pt, 300, 730);
            FontMan.Add(Font.Name.TestMessage, SpriteBatch.Name.Texts, "SCORE<2>", Glyph.Name.Consolas20pt, 500, 730);
            FontMan.Add(Font.Name.Score1, SpriteBatch.Name.Texts, "0000", Glyph.Name.Consolas20pt, 100, 700);

            if (scoreHigh == null)
            {
                scoreHigh = "0000";
            }
            FontMan.Add(Font.Name.ScoreHigh, SpriteBatch.Name.Texts, scoreHigh, Glyph.Name.Consolas20pt, 300, 700);
            FontMan.Add(Font.Name.Score2, SpriteBatch.Name.Texts, "0000", Glyph.Name.Consolas20pt, 500, 700);

            FontMan.Add(Font.Name.TestMessage, SpriteBatch.Name.Texts, "PLAY", Glyph.Name.Consolas20pt, 320, 550);
            FontMan.Add(Font.Name.TestMessage, SpriteBatch.Name.Texts, "SPACE    INVADERS", Glyph.Name.Consolas20pt, 260, 500);
            FontMan.Add(Font.Name.TestMessage, SpriteBatch.Name.Texts, "PUSH <1> OR <2> PLAYERS BUTTON", Glyph.Name.Consolas20pt, 200, 450);
            FontMan.Add(Font.Name.TestMessage, SpriteBatch.Name.Texts, "*SCORE    ADVANCE    TABLE*", Glyph.Name.Consolas20pt, 220, 400);
            FontMan.Add(Font.Name.TestMessage, SpriteBatch.Name.Texts, "  =  200 POINTS", Glyph.Name.Consolas20pt, 270, 350);
            FontMan.Add(Font.Name.TestMessage, SpriteBatch.Name.Texts, "  =  30 POINTS", Glyph.Name.Consolas20pt, 270, 300);
            FontMan.Add(Font.Name.TestMessage, SpriteBatch.Name.Texts, "  =  20 POINTS", Glyph.Name.Consolas20pt, 270, 250);
            FontMan.Add(Font.Name.TestMessage, SpriteBatch.Name.Texts, "  =  10 POINTS", Glyph.Name.Consolas20pt, 270, 200);


            // Alien
            ImageMan.Add(Image.Name.SquidA, Texture.Name.Aliens, 547, 15, 250, 135);
            ImageMan.Add(Image.Name.CrabA, Texture.Name.Aliens, 281, 15, 250, 135);
            ImageMan.Add(Image.Name.OctopusA, Texture.Name.Aliens, 15, 15, 250, 135);
            ImageMan.Add(Image.Name.UFO, Texture.Name.Aliens, 80, 500, 230, 100);

            GameSpriteMan.Add(GameSprite.Name.Squid, Image.Name.SquidA, 100, 600, 35, 30, 255, 255, 255, 1);
            GameSpriteMan.Add(GameSprite.Name.Crab, Image.Name.CrabA, 100, 550, 35, 30, 255, 255, 255, 1);
            GameSpriteMan.Add(GameSprite.Name.Octopus, Image.Name.OctopusA, 100, 500, 35, 30, 255, 255, 255, 1);
            GameSpriteMan.Add(GameSprite.Name.UFO, Image.Name.UFO, 100, 500, 35, 30, 255, 0, 0, 1);

            GameObject pAlienGroup = new AlienGroup(GameObject.Name.AlienGroup, GameSprite.Name.NullObject, 100, 100);

            pAlienGroup.ActivateGameSprite(pSB_Aliens);

            GameObject pAlienColumn = new AlienGroup(GameObject.Name.AlienColumn, GameSprite.Name.NullObject, 100, 100);

            pAlienGroup.Add(pAlienColumn);
            pAlienColumn.ActivateGameSprite(pSB_Aliens);

            GameObject pSquid = new Squid(GameObject.Name.Squid, GameSprite.Name.Squid, 250, 300);

            pAlienColumn.Add(pSquid);
            pSquid.ActivateGameSprite(pSB_Aliens);

            GameObject pCrab = new Crab(GameObject.Name.Crab, GameSprite.Name.Crab, 250, 250);

            pAlienColumn.Add(pCrab);
            pCrab.ActivateGameSprite(pSB_Aliens);

            GameObject pOctopus = new Octopus(GameObject.Name.Octopus, GameSprite.Name.Octopus, 250, 200);

            pAlienColumn.Add(pOctopus);
            pOctopus.ActivateGameSprite(pSB_Aliens);

            UFO pUFO = new UFO(GameObject.Name.UFO, GameSprite.Name.UFO, 250, 350, null);

            pAlienColumn.Add(pUFO);
            pUFO.ActivateGameSprite(pSB_Aliens);

            GameObjectMan.Attach(pAlienGroup);


            // Input
            InputSubject pInputSubject;

            pInputSubject = InputMan.Get1Subject();
            pInputSubject.Attach(new StartGameObserver(1));

            pInputSubject = InputMan.Get2Subject();
            pInputSubject.Attach(new StartGameObserver(2));
        }
Exemplo n.º 17
0
 public override void visitSquid(Squid a)
 {
     //    Debug.WriteLine("MissileRoot Squid");
     CollisionPair.detectCollision(a, (GameObject)this.pChild);
 }