Exemplo n.º 1
0
        public static GameObject RecreateAlienGrid(AlienGrid pAlienGrid, float startingGridSpeed, float start_x = 0.0f, float start_y = 0.0f)
        {
            GhostManager      pGhostManager      = GameStateManager.GetGame().GetStateGhostManager();
            GameObjectManager pGameObjectManager = GameStateManager.GetGame().GetStateGameObjectManager();

            // Attach Composite objects
            Composite pCol;

            for (int i = 0; i < 11; i++)
            {
                pCol = (Composite)pGhostManager.Find(GameObject.Name.AlienGridColumn);
                pGhostManager.Detach(pCol);

                pGameObjectManager.Attach(pCol);

                // Recreate Aliens & Attach to Column
                RecreateAlienGridColumn(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, startingGridSpeed);

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