示例#1
0
        public static Missile ActivateMissile()
        {
            ShipMan pShipMan = ShipMan.PrivInstance();

            Debug.Assert(pShipMan != null);

            // copy over safe copy
            // TODO: This can be cleaned up more... no need to re-calling new()
            Missile pMissile = new Missile(GameObject.Name.Missile, GameSprite.Name.Missile, 400, 100);

            pShipMan.pMissile = pMissile;

            // Attached to SpriteBatches
            SpriteNodeBatch pSB_Player = SpriteNodeBatchManager.Find(SpriteNodeBatch.Name.Players);
            SpriteNodeBatch pSB_Boxes  = SpriteNodeBatchManager.Find(SpriteNodeBatch.Name.Boxes);

            pMissile.ActivateCollisionSprite(pSB_Boxes);
            pMissile.ActivateGameSprite(pSB_Player);

            // Attach the missile to the missile root
            GameObject pMissileGroup = GameObjectManager.Find(GameObject.Name.MissileGroup);

            Debug.Assert(pMissileGroup != null);

            // Add to GameObject Tree - {update and collisions}
            pMissileGroup.Add(pShipMan.pMissile);

            return(pShipMan.pMissile);
        }
        public static Missile ActivateMissile()
        {
            //ShipMan pShipMan = ShipMan.PrivInstance();
            ShipMan pShipMan = ShipMan.instance;

            Debug.Assert(pShipMan != null);

            // copy over safe copy
            Missile pMissile = new Missile(GameObject.Name.Missile, GameSprite.Name.Missile, 400, 100);

            pShipMan.pMissile = pMissile;

            // Attached to SpriteBatches
            SpriteBatch pSB_Aliens = SpriteBatchMan.Find(SpriteBatch.Name.Aliens);
            SpriteBatch pSB_Boxes  = SpriteBatchMan.Find(SpriteBatch.Name.Boxes);

            pMissile.ActivateCollisionSprite(pSB_Boxes);
            pMissile.ActivateGameSprite(pSB_Aliens);

            // Attach the missile to the missile root
            GameObject pMissileGroup = GameObjectMan.Find(GameObject.Name.MissileGroup);

            Debug.Assert(pMissileGroup != null);

            // Add to GameObject Tree - {update and collisions}
            pMissileGroup.Add(pShipMan.pMissile);

            return(pShipMan.pMissile);
        }
示例#3
0
        public static Missile ActivateMissile()
        {
            ShipManager pShipMan = ShipManager.privInstance();

            Debug.Assert(pShipMan != null);

            // get the game object tree
            PCSTree pTree = GameObjectManager.GetRootTree();

            Debug.Assert(pTree != null);

            //create a new missile!!

            // copy over safe copy (create a new one or find in game object tree)
            Missile pMissile = new Missile(GameObject.Name.Missile, GameSprite.Name.Missile, 0, 400, 100);

            pShipMan.pMissile = pMissile;

            // Attach missile to SpriteBatches
            SpriteBatch pSB_Aliens = SpriteBatchManager.Find(SpriteBatch.Name.GameSprites);
            SpriteBatch pSB_Boxes  = SpriteBatchManager.Find(SpriteBatch.Name.SpriteBoxes);

            pMissile.ActivateCollisionSprite(pSB_Boxes);
            pMissile.ActivateGameSprite(pSB_Aliens);

            // Attach the missile to the missile root
            GameObject pMissileRoot = GameObjectManager.Find(GameObject.Name.MissileRoot);

            Debug.Assert(pMissileRoot != null);

            // Add to GameObject Tree - {update and collisions}
            pTree.Insert(pShipMan.pMissile, pMissileRoot);

            return(pShipMan.pMissile);
        }
示例#4
0
        public static Missile ActivateMissile()
        {
            ShipManager shipMan = ShipManager.GetInstance();

            PCSTree pcsTree = GameObjectManager.GetRootTree();

            Debug.Assert(pcsTree != null);

            Missile pMissile = new Missile(GameObjectName.Missile, SpriteBaseName.Missile, 400.0f, 100.0f, 0);

            pMissile.pProxySprite.pSprite.SetColor(ColorFactory.Create(ColorName.Green).pAzulColor);
            shipMan.pMissile = pMissile;

            SpriteBatch sbAliens = SpriteBatchManager.Find(SpriteBatchName.Aliens);
            SpriteBatch sbBoxes  = SpriteBatchManager.Find(SpriteBatchName.Boxes);

            pMissile.ActivateCollisionSprite(sbBoxes);
            pMissile.ActivateGameSprite(sbAliens);

            GameObject pMissileRoot = GameObjectManager.Find(GameObjectName.MissileRoot);

            Debug.Assert(pMissileRoot != null);

            pcsTree.Insert(shipMan.pMissile, pMissileRoot);

            return(shipMan.pMissile);
        }
        public static void ActivateMissile()
        {
            SpriteBatch pAliensBatch = SpriteBatchManager.Find(SpriteBatch.Name.Aliens);
            SpriteBatch pBoxBatch    = SpriteBatchManager.Find(SpriteBatch.Name.Boxes);

            GameObject pMissileGroup = GameObjectManager.Find(GameObject.Name.MissileGroup);

            Debug.Assert(pMissileGroup != null);

            pMissile.ActivateCollisionSprite(pBoxBatch);
            pMissile.ActivateGameSprite(pAliensBatch);

            pMissileGroup.Add(pMissile);
        }
示例#6
0
        public static Missile ActivateMissile(Ship pShip)
        {
            Missile pMissile = pShip.GetMissile();
            ShipMan pShipMan = ShipMan.PrivInstance();

            Debug.Assert(pShipMan != null);

            SpriteBatch pSB_Aliens = SpriteBatchMan.Find(SpriteBatch.Name.Aliens);
            SpriteBatch pSB_Boxes  = SpriteBatchMan.Find(SpriteBatch.Name.Boxes);

            pMissile.ActivateCollisionSprite(pSB_Boxes);
            pMissile.ActivateGameSprite(pSB_Aliens);
            pMissile.pPlayer = pShip.pPlayer;

            GameObject pMissileGroup = GameObjectMan.Find(GameObject.Name.MissileGroup);

            Debug.Assert(pMissileGroup != null);

            pMissileGroup.Add(pMissile);
            return(pMissile);
        }
示例#7
0
        public Alien Create(GameObjectName goName, float x, float y)
        {
            Alien pAlien = null;

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

            case GameObjectName.Missile:
                pAlien = new Missile(x, y);
                break;
            }
            Debug.Assert(pAlien != null);
            //this.pTree.dumpTree();
            this.pTree.Insert(pAlien, this.pParent);
            //this.pTree.dumpTree();
            pAlien.ActivateGameSprite(this.pSpriteBatch);
            this.pSpriteBoxBatch.Attach(pAlien.pCollisionObject.pCollisionSpriteBox);
            return(pAlien);
        }
示例#8
0
        //----------------------------------------------------------------------------------
        // Abstract Methods
        //----------------------------------------------------------------------------------
        public override void Execute(float deltaTime)
        {
            //Debug.WriteLine("event: {0}", deltaTime);

            // Create missile
            float xVal = this.pRandom.Next(100, 700);
            // Hack: Also if I spawn too low it happens
            float yVal = 0.0f;

            Missile pMissile = new Missile(GameObject.Name.Missile, GameSprite.Name.Missile, xVal, yVal);

            //     Debug.WriteLine("----x:{0}", value);

            pMissile.ActivateCollisionSprite(pSB_Boxes);
            pMissile.ActivateGameSprite(pSB_Invaders);

            // Attach the missile to the missile root
            GameObject pMissileGroup = GameObjectManager.Find(GameObject.Name.MissileGroup);

            Debug.Assert(pMissileGroup != null);

            // Add to GameObject Tree - {update and collisions}
            pMissileGroup.Add(pMissile);
        }