Beispiel #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);
        }
Beispiel #2
0
        internal static void DestroyAlienGrid(AlienGrid pAlienGrid)
        {
            // Iterate through AlienGridColumns
            AlienGridColumn pGridColumn = (AlienGridColumn)pAlienGrid.GetFirstChild();

            while (pGridColumn != null)
            {
                // Iterate through shield bricks
                Alien pAlien = (Alien)pGridColumn.GetFirstChild();
                while (pAlien != null)
                {
                    // Remove Alien from composite
                    pGridColumn.Remove(pAlien);

                    // Kill Alien
                    pAlien.Remove(SpriteBatch.Name.Alien, SpriteBatch.Name.CollisionBox);

                    // Get next Alien
                    pAlien = (Alien)pGridColumn.GetFirstChild();
                }

                // Remove AlienGridColumn from composite
                pAlienGrid.Remove(pGridColumn);

                // Kill AlienGridColumn
                pGridColumn.Remove(SpriteBatch.Name.Alien, SpriteBatch.Name.CollisionBox);

                // Get next AlienGridColumn
                pGridColumn = (AlienGridColumn)pAlienGrid.GetFirstChild();
            }
        }
Beispiel #3
0
        public override void VisitAlienGridColumn(AlienGridColumn agc)
        {
            //Debug.WriteLine("         collide:  {0} <-> {1}", agc.GetName(), this.name);

            // AlienGridColumn vs ShieldBrick
            GameObject pGameObj = Iterator.GetChildGameObject(agc);

            CollisionPair.Collide(this, pGameObj);
        }
 public virtual void VisitAlienGridColumn(AlienGridColumn agc)
 {
     // no differed to subcass
     Debug.WriteLine("Visit by AlienGridColumn not implemented");
     Debug.Assert(false);
 }