Exemplo n.º 1
0
        public static void moveToGhostManager()
        {
            GameObjectNodeManager gamMInstance = GameObjectNodeManager.getSingletonInstance();

            Debug.Assert(gamMInstance != null);

            GameObjectNode root = (GameObjectNode)gamMInstance.activeList;

            Debug.Assert(root != null);

            while (root != null)
            {
                PCSTreeReverseIterator pcsTreeIter = new PCSTreeReverseIterator(root.getGameObject());
                Debug.Assert(pcsTreeIter != null);
                if (root.getGameObject().cGameObjectName == GameObject.GameObjectName.AlienGrid)
                {
                    GameObject gameObj = (GameObject)pcsTreeIter.First();
                    while (!pcsTreeIter.IsDone())
                    {
                        gameObj = (GameObject)pcsTreeIter.Next();
                        gameObj.remove();
                    }
                }
                root = (GameObjectNode)root.pNext;
            }
        }
Exemplo n.º 2
0
        // Updates all the nodes in the tree
        public static void update()
        {
            GameObjectNodeManager gamMInstance = GameObjectNodeManager.getSingletonInstance();

            Debug.Assert(gamMInstance != null);

            GameObjectNode root = (GameObjectNode)gamMInstance.activeList;

            Debug.Assert(root != null);

            while (root != null)
            {
                // PCSTreeForwardIterator pcsTreeIter = new PCSTreeForwardIterator(root.getGameObject());
                PCSTreeReverseIterator pcsTreeIter = new PCSTreeReverseIterator(root.getGameObject());
                Debug.Assert(pcsTreeIter != null);

                //iterate all the nodes inside the roots
                GameObject gameObj = (GameObject)pcsTreeIter.First();
                while (!pcsTreeIter.IsDone())
                {
                    gameObj.update();
                    gameObj = (GameObject)pcsTreeIter.Next();
                }
                root = (GameObjectNode)root.pNext;
            }
        }
Exemplo n.º 3
0
        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();
                }
            }
        }
Exemplo n.º 4
0
        public void removeChildren()
        {
            GameObject             rootObj     = (GameObject)cPCSTree.getRoot();
            PCSTreeReverseIterator pcsTreeIter = new PCSTreeReverseIterator(rootObj);

            Debug.Assert(pcsTreeIter != null);
            GameObject gameObj = (GameObject)pcsTreeIter.First();

            while (!pcsTreeIter.IsDone())
            {
                if (gameObj.cGameObjectName != GameObject.GameObjectName.ShieldGrid)
                {
                    gameObj.remove();
                }
                gameObj = (GameObject)pcsTreeIter.Next();
            }
        }
Exemplo n.º 5
0
        public static void DeactivateCollisionBoxes()
        {
            // Remove Bombs
            GameObject             bombRoot = GameObjectManager.Find(GameObjectName.BombRoot);
            PCSTreeReverseIterator iterBomb = new PCSTreeReverseIterator(bombRoot);
            GameObject             pGoBomb  = (GameObject)iterBomb.First();

            while (!iterBomb.IsDone())
            {
                pGoBomb.DeactivateCollisionSprite();
                pGoBomb = (GameObject)iterBomb.Next();
            }
            GameObject             missileRoot = GameObjectManager.Find(GameObjectName.MissileRoot);
            PCSTreeReverseIterator iterMissile = new PCSTreeReverseIterator(missileRoot);
            GameObject             pGOMissile  = (GameObject)iterMissile.First();

            while (!iterMissile.IsDone())
            {
                pGOMissile.DeactivateCollisionSprite();
                pGOMissile = (GameObject)iterMissile.Next();
            }

            // 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.DeactivateCollisionSprite();
                    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.DeactivateCollisionSprite();
                pGameObj = (GameObject)iterGrid.Next();
            }
        }
Exemplo n.º 6
0
        public static void Update()
        {
            GameObjectManager goMan  = GameObjectManager.GetInstance();
            GameObjectNode    goNode = (GameObjectNode)goMan.pActive;

            while (goNode != null)
            {
                PCSTreeReverseIterator iter = new PCSTreeReverseIterator(goNode.pGameObject);
                GameObject             go   = (GameObject)iter.First();
                while (!iter.IsDone())
                {
                    go.Update();
                    go = (GameObject)iter.Next();
                }
                goNode = (GameObjectNode)goNode.pDNext;
            }
        }
Exemplo n.º 7
0
        public static void changeColor()
        {
            GameObjectNodeManager gamMInstance = GameObjectNodeManager.getSingletonInstance();

            Debug.Assert(gamMInstance != null);

            GameObjectNode root = (GameObjectNode)gamMInstance.activeList;

            Debug.Assert(root != null);

            while (root != null)
            {
                PCSTreeReverseIterator pcsTreeIter = new PCSTreeReverseIterator(root.getGameObject());
                Debug.Assert(pcsTreeIter != null);
                GameObject gameObj = (GameObject)pcsTreeIter.First();
                while (!pcsTreeIter.IsDone())
                {
                    if (gameObj.cGameObjectName == GameObject.GameObjectName.AlienGrid ||
                        gameObj.cGameObjectName == GameObject.GameObjectName.Column ||
                        gameObj.cGameObjectName == GameObject.GameObjectName.Crab ||
                        gameObj.cGameObjectName == GameObject.GameObjectName.Octopus ||
                        gameObj.cGameObjectName == GameObject.GameObjectName.Squid ||
                        gameObj.cGameObjectName == GameObject.GameObjectName.AlienExplosion ||
                        gameObj.cGameObjectName == GameObject.GameObjectName.UFORoot ||
                        gameObj.cGameObjectName == GameObject.GameObjectName.AlienUFO ||
                        gameObj.cGameObjectName == GameObject.GameObjectName.ShieldGrid ||
                        gameObj.cGameObjectName == GameObject.GameObjectName.ShieldUnit ||
                        gameObj.cGameObjectName == GameObject.GameObjectName.ShieldColumn ||
                        gameObj.cGameObjectName == GameObject.GameObjectName.ShieldBrick ||
                        gameObj.cGameObjectName == GameObject.GameObjectName.BombRoot ||
                        gameObj.cGameObjectName == GameObject.GameObjectName.Bomb ||
                        gameObj.cGameObjectName == GameObject.GameObjectName.MissileRoot ||
                        gameObj.cGameObjectName == GameObject.GameObjectName.StraightMissile ||
                        gameObj.cGameObjectName == GameObject.GameObjectName.CannonShip ||
                        gameObj.cGameObjectName == GameObject.GameObjectName.ShipRoot
                        )
                    {
                        gameObj.cCollisionObj.cSpriteBox.setColor(Unit.spriteBoxColor);
                    }
                    gameObj = (GameObject)pcsTreeIter.Next();
                }
                root = (GameObjectNode)root.pNext;
            }
        }
Exemplo n.º 8
0
        public void removeChildren()
        {
            GameObject             rootObj     = (GameObject)cPCSTree.getRoot();
            PCSTreeReverseIterator pcsTreeIter = new PCSTreeReverseIterator(rootObj);

            Debug.Assert(pcsTreeIter != null);
            GameObject gameObj = (GameObject)pcsTreeIter.First();

            while (!pcsTreeIter.IsDone())
            {
                if (gameObj.cGameObjectName != GameObject.GameObjectName.ShipRoot)
                {
                    gameObj.remove();
                }
                else
                {
                    gameObj.x = 0;
                    gameObj.y = 0;
                    gameObj.cCollisionObj.cCollisionRectangle.Set(0, 0, 0, 0);
                }
                gameObj = (GameObject)pcsTreeIter.Next();
            }
        }