Esempio n. 1
0
 public override void visitBomb(Bomb v, CollisionPair p)
 {
     GameObject shieldBlock = this;
     while (shieldBlock.Sibling != null)
     {
         shieldBlock = (GameObject)shieldBlock.Sibling;
     }
     p.notify(shieldBlock, v);
 }
Esempio n. 2
0
 public static Bomb create(Bomb.CrossType type, float x, float y)
 {
     Bomb bomb = new Bomb(GameObject.Name.Bombs, Index.Index_Null, SpriteEnum.Cross,
                 new Azul.Color(1f, 1f, 1f),
                 new Cross(), x, y);
     Debug.Assert(bomb.Spr != null);
     Instance.batch.attach(bomb.Spr);
     SpriteBatchManager.attachToGroup(bomb.ColObj.Spr, BatchGroup.BatchType.Collisions);
     GameObjectManager.insert(bomb, Instance.treeRoot);
     return bomb;
 }
 //----------------------------------------------------------------------------------
 // Visit Bomb
 //----------------------------------------------------------------------------------
 public virtual void VisitBomb(Bomb b)
 {
     // no differed to subcass
     Debug.WriteLine("Visit by Bomb not implemented");
     Debug.Assert(false);
 }
 public override void VisitBomb(Bomb b)
 {
     //Nothin happens
 }
Esempio n. 5
0
 public override void VisitBomb(Bomb b)
 {
     // does nothing
     //its okay
 }
Esempio n. 6
0
 public override void Fall(Bomb pBomb)
 {
     Debug.Assert(pBomb != null);
 }
Esempio n. 7
0
        public override void VisitBomb(Bomb b)
        {
            GameObject pGameObj = (GameObject)Iterator.GetChild(this);

            ColPair.Collide(b, pGameObj);
        }
Esempio n. 8
0
 public virtual void VisitBomb(Bomb b)
 {
     Debug.Assert(false);
 }
Esempio n. 9
0
 public override void VisitBomb(Bomb b)
 {
     // Bomb vs Wall-Top
     //Does nothing, here to prevent crashing.
 }
 public override void VisitBomb(Bomb b)
 {
     // Bomb vs ShieldColumn
     ColPair.Collide(b, (GameObject)Iterator.GetChild(this));
 }
Esempio n. 11
0
        public Bomb Create(Type type)
        {
            InvaderCategory pInvader = InvaderGridManager.GetRandomBombDropper(this.pInvaderGrid);
            Bomb            pBomb    = null;

            if (pInvader != null)
            {
                float posX = pInvader.x;
                float posY = pInvader.y;

                switch (type)
                {
                case Type.Plain:
                    pBomb = new Bomb(GameObject.Name.Bomb, Sprite.Name.BombPlain, BoxSprite.Name.BombBox, posX, posY);
                    break;

                case Type.ZigZag:
                    pBomb = new Bomb(GameObject.Name.Bomb, Sprite.Name.BombZigZag, BoxSprite.Name.BombBox, posX, posY);
                    break;

                case Type.Dagger:
                    pBomb = new Bomb(GameObject.Name.Bomb, Sprite.Name.BombDagger, BoxSprite.Name.BombBox, posX, posY);
                    break;

                case Type.Rolling:
                    pBomb = new Bomb(GameObject.Name.Bomb, Sprite.Name.BombRolling, BoxSprite.Name.BombBox, posX, posY);
                    break;

                default:
                    // something is wrong
                    Debug.Assert(false, "Bomb type not supported by this factory");
                    break;
                }

                // set pointer back to invader who dropped the bomb
                pBomb.pInvaderWhoDroppedMe = pInvader;
                pBomb.pInvaderWhoDroppedMe.canLaunchBomb = false; //block this invader from dropping another bomb until curren bomb dies

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

                // Attached to Batches
                this.pBoxSpriteBatch.Attach(pBomb.poColObj.pColSprite);
                this.pSpriteBatch.Attach(pBomb.pProxySprite);

                // Add Collision Pairs and Observers
                ColPair pMissile_BombColPair = ColPairManager.Add(ColPair.Name.Missile_Bomb, pBomb, ShipManager.GetMissile());
                Debug.Assert(pMissile_BombColPair != null);

                ColPair pBomb_FloorColPair = ColPairManager.Add(ColPair.Name.Bomb_Floor, pBomb, pWallMan.GetFloor());
                Debug.Assert(pBomb_FloorColPair != null);

                ColPair pBomb_ShipColPair = ColPairManager.Add(ColPair.Name.Bomb_Ship, pBomb, ShipManager.GetShip());
                Debug.Assert(pBomb_ShipColPair != null);

                // Observers for Bomb vs Missile
                pMissile_BombColPair.Attach(new RemoveCollisionPairObserver(pMissile_BombColPair));
                pMissile_BombColPair.Attach(new RemoveCollisionPairObserver(pBomb_FloorColPair));
                pMissile_BombColPair.Attach(new RemoveCollisionPairObserver(pBomb_ShipColPair));
                pMissile_BombColPair.Attach(new ShipMissileReadyObserver());
                pMissile_BombColPair.Attach(new ShipRemoveMissileObserver());
                pMissile_BombColPair.Attach(new RemoveBombObserver());

                //// Observers for Bomb vs Floor
                pBomb_FloorColPair.Attach(new RemoveCollisionPairObserver(pBomb_FloorColPair));
                pBomb_FloorColPair.Attach(new RemoveCollisionPairObserver(pMissile_BombColPair));
                pBomb_FloorColPair.Attach(new RemoveCollisionPairObserver(pBomb_ShipColPair));
                pBomb_FloorColPair.Attach(new RemoveBombObserver());

                // Observers for Bomb vs Ship
                pBomb_ShipColPair.Attach(new RemoveCollisionPairObserver(pBomb_ShipColPair));
                pBomb_ShipColPair.Attach(new RemoveCollisionPairObserver(pBomb_FloorColPair));
                pBomb_ShipColPair.Attach(new RemoveCollisionPairObserver(pMissile_BombColPair));
                pBomb_ShipColPair.Attach(new RemoveShipObserver());
                pBomb_ShipColPair.Attach(new RemoveBombObserver());


                GameObject pShieldZone = GameObjectManager.UnsafeFind(GameObject.Name.ShieldZone);
                if (pShieldZone != null)
                {
                    // Add Collision pair for Bomb vs Shields
                    ColPair pBomb_ShieldColPair = ColPairManager.Add(ColPair.Name.Bomb_Shield, pBomb, pShieldZone);
                    Debug.Assert(pBomb_ShieldColPair != null);

                    // Added observers to previous shield pairs to remove the bomb vs shield col pair
                    pMissile_BombColPair.Attach(new RemoveCollisionPairObserver(pBomb_ShieldColPair));
                    pBomb_FloorColPair.Attach(new RemoveCollisionPairObserver(pBomb_ShieldColPair));
                    pBomb_ShipColPair.Attach(new RemoveCollisionPairObserver(pBomb_ShieldColPair));

                    // Observers for Bomb vs Shield
                    pBomb_ShieldColPair.Attach(new RemoveCollisionPairObserver(pBomb_ShieldColPair));
                    pBomb_ShieldColPair.Attach(new RemoveCollisionPairObserver(pBomb_FloorColPair));
                    pBomb_ShieldColPair.Attach(new RemoveCollisionPairObserver(pMissile_BombColPair));
                    pBomb_ShieldColPair.Attach(new RemoveCollisionPairObserver(pBomb_ShipColPair));
                    pBomb_ShieldColPair.Attach(new RemoveBombObserver());
                    pBomb_ShieldColPair.Attach(new RemoveShieldBrickObserver());
                }
            }

            return(pBomb);
        }
 //----------------------------------------------------------------------------------
 // Abstract Methods
 //----------------------------------------------------------------------------------
 public override void Fall(Bomb pBomb)
 {
     Debug.Assert(pBomb != null);
     // Do nothing special
 }
Esempio n. 13
0
 public override void VisitBomb(Bomb b)
 {
     // Do nothing here -- Override in Bottom Wall class for bomb <--> bottom wall collision
 }
Esempio n. 14
0
 public override void VisitBomb(Bomb b)
 {
     // Bomb vs WallRoot
     ColPair.Collide(b, (GameObject)this.pChild);
 }
Esempio n. 15
0
 public abstract void Fall(Bomb pBomb);
 public RemoveBombEvent()
 {
     this.pBomb = null;
 }
Esempio n. 17
0
 public override void VisitBomb(Bomb b)
 {
     //AlienBomb vs ShieldColumn
     ColPair.Collide(b, (GameObject)this.pChild);
 }
 public RemoveBombObserver(RemoveBombObserver pRBbserver)
 {
     this.pBomb = pRBbserver.pBomb;
 }
 public ActivateBombSprite(Bomb b)
 {
     this.bomb = b;
 }
Esempio n. 20
0
 public virtual void visitBomb(Bomb v, CollisionPair p)
 {
     Debug.Assert(false, "Shouldn't have been called");
 }
 public void setBomb(Bomb b)
 {
     Debug.Assert(b != null);
     this.bomb = b;
 }
Esempio n. 22
0
        public override void Fall(Bomb pBomb)
        {
            Debug.Assert(pBomb != null);

            // Do nothing for this strategy
        }
 public ActivateBombSprite()
 {
     this.bomb       = null;
     this.associated = false;
 }
Esempio n. 24
0
 public override void visitBomb(Bomb v, CollisionPair p)
 {
     p.notify(this, v);
 }
Esempio n. 25
0
 public override void BombFall(Bomb pBomb)
 {
 }
Esempio n. 26
0
 public override void VisitBomb(Bomb b)
 {
 }
Esempio n. 27
0
 public override void VisitBomb(Bomb pBomb)
 {
     CollisionPair.Collide(pBomb, (GameObject)this.pChild);
 }
Esempio n. 28
0
 public override void VisitBomb(Bomb b)
 {
     // Missile vs ShieldRoot
     CollPair.Collide(b, (GameObject)Iterator.GetChild(this));
 }
Esempio n. 29
0
 public RemoveBombObserver(Bomb pBomb)
 {
     this.pBomb = pBomb;
 }
 public RemoveMissileAndBombObserver(Bomb pBomb, Missile pMissile)
 {
     this.pBomb    = pBomb;
     this.pMissile = pMissile;
 }
Esempio n. 31
0
        public void dropBomb()
        {
            Bomb pBomb = BombMan.ActiveBomb();

            pBomb.setPos(this.x + 5, this.y - 40);
        }
Esempio n. 32
0
 abstract public void Fall(Bomb pBomb);
Esempio n. 33
0
        public override void Execute(float deltaTime, TimeEvent.Name name)
        {
            //if (Component.right > 896 || Component.left < 0.0f)
            //{
            //    Component.speed *= -1.0f;
            //    grid.MoveDown();
            //}
            //Component.right += Component.speed;
            //Component.left += Component.speed;
            grid.MoveGrid();

            IrrKlang.ISoundEngine pSndEngine = SpaceInvaders.GetInstance().sndEngine;
            pSndEngine.SoundVolume = 0.2f;
            if (counting % 4 == 0)
            {
                pSndEngine.Play2D("fastinvader1.wav");
            }
            else if (counting % 4 == 1)
            {
                pSndEngine.Play2D("fastinvader2.wav");
            }
            else if (counting % 4 == 2)
            {
                pSndEngine.Play2D("fastinvader3.wav");
            }
            else if (counting % 4 == 3)
            {
                pSndEngine.Play2D("fastinvader4.wav");
            }
            counting++;

            //1, using ForwardIterator
            ForwardIterator pIterator = new ForwardIterator(grid);
            Random          rnd       = new Random();
            int             num       = rnd.Next(0, 11);

            Debug.WriteLine("        random number generated: {0}", num);
            Component pColumn = null;
            bool      flag    = false;

            for (int i = 0; i <= num; i++)
            {
                if (pColumn == null && flag == true)
                {
                    break;
                }
                pColumn = pIterator.Next();
                flag    = true;
                if (pColumn == null)
                {
                    break;
                }
                while (pColumn.holder != Component.Container.COMPOSITE)
                {
                    pColumn = pIterator.Next();
                    if (pColumn == null)
                    {
                        break;
                    }
                }
            }



            //2, using Iterator
            //Component pColumn = Iterator.GetChild(grid);
            //pColumn = Iterator.GetSibling(pColumn);
            if (pColumn != null)
            {
                //Debug.WriteLine("  3,     child type: {0}", pColumn);
                Bomb pBomb = ((AlienColumn)pColumn).ActivateBomb(rnd);
                pBomb.ActivateGameSprite(this.pSpriteBatch);
                pBomb.ActivateCollisionSprite(this.pCollisionSpriteBatch);
                pTree.Add(pBomb);
            }


            // Add itself back to timer
            TimerMan.Add(name, this, deltaTime - 0.003f);
        }
        //public RemoveAlienEvent(GameObject pAlien) {

        //    Debug.Assert(pAlien != null);
        //    this.pAlien = pAlien;

        //}
        public void SetBomb(Bomb pBomb)
        {
            Debug.Assert(pBomb != null);
            this.pBomb = pBomb;
        }
Esempio n. 35
0
 public override void visitBomb(Bomb v, CollisionPair p)
 {
     p.collision((GameObject)this.child, v);
 }