Exemplo n.º 1
0
        public static GameObject CreateAlienGrid(float start_x = 0.0f, float start_y = 0.0f)
        {
            // Create Composite objects
            Composite pAlienGrid = new AlienGrid(Composite.CompositeName.AlienGrid, 20.0f, 0.0f);

            pAlienGrid.SetCollisionObjectLineColor(1.0f, 1.0f, 0.0f);
            pAlienGrid.ActivateSprite(GameStateManager.GetGame().GetStateSpriteBatchManager().Find(SpriteBatch.Name.Alien));
            pAlienGrid.ActivateCollisionSprite(GameStateManager.GetGame().GetStateSpriteBatchManager().Find(SpriteBatch.Name.CollisionBox));
            GameStateManager.GetGame().GetStateCompositeManager().Attach(pAlienGrid);
            GameStateManager.GetGame().GetStateGameObjectManager().Attach(pAlienGrid);

            Composite pCol;

            for (int i = 0; i < 11; i++)
            {
                pCol = new AlienGridColumn(Composite.CompositeName.AlienCol1 + i);
                GameStateManager.GetGame().GetStateGameObjectManager().Attach(pCol);

                // Generate Aliens & Attach to Column
                GenerateNewAlienGridColumn(pCol, (start_x + (60.0f * i)), start_y);

                // Append Columns to AlienGrid
                pAlienGrid.Add(pCol);
            }

            // Add Initial AlienGridMovement Event
            AlienGridMovement pAlienGridMovement = new AlienGridMovement(pAlienGrid);

            GameStateManager.GetGame().GetStateQueuedTimeEventManager().Enqueue(TimeEvent.Name.AlienGridMovement, pAlienGridMovement, GameStateManager.GetGame().GetStateLevelInitialAlienGridSpeed());

            return(pAlienGrid);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
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);
        }