コード例 #1
0
        public static Bomb ActiveBomb()
        {
            //ensure call Create() first
            BombMan pMan = BombMan.GetInstance();

            Debug.Assert(pMan != null);

            GameSprite.Name spriteName    = GameSprite.Name.BombDagger + pMan.randNum.Next(3);
            FallStrategy    pFallStrategy = pMan.chooseFallStrategy(spriteName);

            Debug.Assert(pFallStrategy != null);

            // create Bomb
            Bomb pBomb = new Bomb(GameObject.Name.Bomb, spriteName, pFallStrategy, 100, 100);

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

            //attach Bomb to BombGroup
            GameObject pBombGroup = GameObjectMan.Find(GameObject.Name.BombGroup);

            Debug.Assert(pBombGroup != null);

            // add to GameObject
            pBombGroup.add(pBomb);

            return(pBomb);
        }