Exemple #1
0
        public static Missile ActivateMissile()
        {
            //ensure call Create() first
            ShipMan pShipMan = ShipMan.GetInstance();

            Debug.Assert(pShipMan != null);

            // create Missile
            Missile pMissile = new Missile(GameObject.Name.Missile, GameSprite.Name.Missile, 400, 100);

            pShipMan.pMissile = pMissile;

            // activate collision sprite and game sprite
            pMissile.activateCollisionSprite(SpriteBatchMan.Find(SpriteBatch.Name.Boxes));
            pMissile.activateGameSprite(SpriteBatchMan.Find(SpriteBatch.Name.Missiles));

            // attach missile to missile group
            GameObject pMissileGroup = GameObjectMan.Find(GameObject.Name.MissileGroup);

            Debug.Assert(pMissileGroup != null);

            // Add to GameObject
            pMissileGroup.add(pShipMan.pMissile);

            return(pShipMan.pMissile);
        }