コード例 #1
0
ファイル: GameManager.cs プロジェクト: ccaunca/Projects
        public static void ClearGameScreen()
        {
            // Remove Bombs
            GameObject             bombRoot = GameObjectManager.Find(GameObjectName.BombRoot);
            PCSTreeReverseIterator iterBomb = new PCSTreeReverseIterator(bombRoot);
            GameObject             pGoBomb  = (GameObject)iterBomb.First();

            while (!iterBomb.IsDone())
            {
                pGoBomb.Remove();
                pGoBomb = (GameObject)iterBomb.Next();
            }
            Missile pMissile = ShipManager.GetMissile();

            if (pMissile != null && pMissile.enabled)
            {
                pMissile.Remove();
            }
            // Remove Shields
            for (int i = 1; i < 5; ++i)
            {
                GameObject             shieldRoot = GameObjectManager.Find(GameObjectName.ShieldRoot, i);
                PCSTreeReverseIterator iter       = new PCSTreeReverseIterator(shieldRoot);
                GameObject             pGO        = (GameObject)iter.First();
                while (!iter.IsDone())
                {
                    pGO.Remove();
                    pGO = (GameObject)iter.Next();
                }
            }
            // Remove Alien Grid
            GameObject             grid     = GameObjectManager.Find(GameObjectName.Grid);
            PCSTreeReverseIterator iterGrid = new PCSTreeReverseIterator(grid);
            GameObject             pGameObj = (GameObject)iterGrid.First();

            while (!iterGrid.IsDone())
            {
                pGameObj.Remove();
                pGameObj = (GameObject)iterGrid.Next();
            }
            // Remove CollisionBoxes
            if (GameManager.GetCollisionBoxes())
            {
                GameObject             pWallRoot = GameObjectManager.Find(GameObjectName.WallRoot);
                PCSTreeReverseIterator iterWall  = new PCSTreeReverseIterator(pWallRoot);
                GameObject             pGO       = (GameObject)iterWall.First();
                while (!iterWall.IsDone())
                {
                    pGO.Remove();
                    pGO = (GameObject)iterWall.Next();
                }
            }
        }