Exemple #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;
            }
        }
Exemple #2
0
        public static void cleanup()
        {
            GameObjectNodeManager gamMInstance = GameObjectNodeManager.getSingletonInstance();

            Debug.Assert(gamMInstance != null);

            GameObjectNode gameObjNode = (GameObjectNode)gamMInstance.activeList;
            GameObject     rootNode    = gameObjNode.getGameObject();

            if (rootNode.cGameObjectName == GameObject.GameObjectName.AlienGrid)
            {
                GameObject column = (GameObject)rootNode.pChild;
                if (column.pChild == null)
                {
                    Debug.WriteLine("no aliens");
                    if (column.pSibling != null)
                    {
                        Debug.WriteLine("column has sibling");
                        column = (GameObject)column.pSibling;
                        column.pSibling.pParent = (PCSNode)rootNode;
                        column.remove();
                    }
                    else
                    {
                        // rootNode.remove(column);
                        column.pForward = null;
                        column.pReverse = null;
                        column.remove();
                        rootNode.pForward = null;
                        rootNode.pReverse = null;
                        rootNode.remove();

                        Debug.WriteLine("Done");
                    }
                }
            }
        }
Exemple #3
0
        public static void Remove(GameObject pNode)
        {
            Debug.Assert(pNode != null);

            //ensure call Create() first
            GameObjectMan pMan = GameObjectMan.GetInstance();

            Debug.Assert(pMan != null);

            // 1. find tree root
            GameObject pTmp  = pNode;
            GameObject pRoot = null;

            while (pTmp != null)
            {
                pRoot = pTmp;
                pTmp  = (GameObject)Iterator.GetParent(pTmp);
            }

            // 2. pRoot is the tree we looking for, walk the active list looking for pTree
            GameObjectNode pTree = (GameObjectNode)pMan.baseGetActiveList();

            while (pTree != null)
            {
                if (pTree.getGameObject() == pRoot)
                {
                    break;
                }

                // go to next tree
                pTree = (GameObjectNode)pTree.pNext;
            }

            // 3. pTree is the tree that holds pNode, remove pNode from pTree
            Debug.Assert(pTree != null);
            Debug.Assert(pTree.getGameObject() != null);

            // always have a group
            Debug.Assert(pTree.getGameObject() != pNode);

            GameObject pParent = (GameObject)Iterator.GetParent(pNode);

            Debug.Assert(pParent != null);

            // remove the node
            pParent.remove(pNode);
        }
Exemple #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();
            }
        }
        public override void notify()
        {
            // Delete missile
            GameObject gameObjA = this.colSubject.gameObjA;
            GameObject gameObjB = this.colSubject.gameObjB;

            Debug.WriteLine("ShipRemoveMissileObserver: {0} {1}", gameObjA.cGameObjectName, gameObjB.cGameObjectName);

            if (gameObjA.cGameObjectName == GameObject.GameObjectName.StraightMissile)
            {
                gameObjA.remove();
            }
            else
            {
                gameObjB.remove();
            }
        }
        public override void execute(float deltaTime)
        {
            GameObject pParent = (GameObject)Iterator.GetParent(this.pGameObject);

            this.pGameObject.remove();

            while (checkParent(pParent))
            {
                GameObject pGrandParent = (GameObject)Iterator.GetParent(pParent);
                //if (pParent.getName() == GameObject.Name.AlienGroup) break;
                if (pGrandParent == null)
                {
                    break;
                }

                pParent.remove();
                pParent = pGrandParent;
            }
        }
        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();
            }
        }
 public override void execute(float deltaTime)
 {
     Debug.WriteLine("Inside Game Object Remove");
     gameObject.remove();
 }