Пример #1
0
 public static void Update()
 {
     for (DLinkedNode rootNode = _objectMan.GetActive().GetHead(); rootNode != null; rootNode = rootNode.Next)
     {
         GameObjectNode  root  = (GameObjectNode)rootNode;
         ReverseIterator rIt   = new ReverseIterator(root.GameObj);
         Component       first = rIt.First();
         while (!rIt.IsDone())
         {
             GameObject pGameObj = (GameObject)first;
             pGameObj.Update();
             first = rIt.Next();
         }
         root.Update();
     }
 }
Пример #2
0
        public override void Remove()
        {
            // Since the Root object is being drawn
            // 1st set its size to zero
            this.poColObj.poColRect.Set(0, 0, 0, 0);
            base.Update();

            // Update the parent (missile root)
            GameObject pParent = (GameObject)this.pParent;

            pParent.Update();

            // Now remove it
            base.Remove();

            this.onScreen = false;
        }
Пример #3
0
        public override void Remove(Component c)
        {
            // Keenan(delete.E)
            // Since the Root object is being drawn
            // 1st set its size to zero
            this.poCollObj.poColRect.Set(0, 0, 0, 0);
            base.Update();

            // Update the parent (missile root)
            GameObject pParent = (GameObject)this.pParent;

            pParent.Update();


            // Now remove it
            base.Remove();
        }
Пример #4
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;
            }
        }
        public override void Remove()
        {
            // Since the Root object is being drawn
            // 1st set its size to zero
            this.poColObj.poColRect.Set(0, 0, 0, 0);
            base.Update();

            //// Update the parent (missile root)
            GameObject pParent = (GameObject)this.pParent;

            //remove missile from composite... missile only has one parent..need to find root for others?
            pParent.Remove(this);
            pParent.Update();

            // Now remove it
            base.Remove();
        }
Пример #6
0
        private void MoveTree(GameObject pNode)
        {
            PCSNode pChild = null;

            pNode.x += this.movementXDirection;
            pNode.y += this.movementYDirection;
            pNode.Update();
            if (pNode.pChild == null)
            {
                // base case
            }
            else
            {
                pChild = pNode.pChild;
                while (pChild != null)
                {
                    MoveTree((GameObject)pChild);
                    pChild = pChild.pSibling;
                }
            }
        }
Пример #7
0
        public override void Notify()
        {
            //Debug.WriteLine("RemoveFlyingSaucerObserver: {0} {1}", this.pSubject.pObjA, this.pSubject.pObjB);

            // This cast will throw an exception if wrong
            this.pAlien = (FlyingSaucer)this.pSubject.pObjA;

            pAlien.GetCollisionObject().GetCollisionRect().Set(0, 0, 0, 0);
            pAlien.Update();

            if (!pAlien.IsMarkedForDeath())
            {
                pAlien.MarkForDeath();

                // Delay - remove object later
                RemoveFlyingSaucerObserver pObserver = new RemoveFlyingSaucerObserver(this);
                GameStateManager.GetGame().GetStateDelayedObjectManager().Attach(pObserver);
            }

            TimerManager.Add(TimeEvent.Name.DeployFlyingSaucer, new DeployFlyingSaucerCommand(), r.Next(30, 61));
        }
Пример #8
0
        public static void Update()
        {
            // go through active list and update everything in it
            // while loop

            GONodeMan pMan = GONodeMan.PrivGetInstance();

            Debug.Assert(pMan != null);

            //Debug.WriteLine("---------------");

            GONode pGONode = (GONode)pMan.BaseGetActive();


            while (pGONode != null)
            {
                //Debug.WriteLine("update: GameObjectTree {0} ({1})", pGONode.poGameObject, pGONode.poGameObject.GetHashCode());
                //Debug.WriteLine("   +++++");
                if (pGONode.poGameObject.GetPlayerOption() == true)
                {
                    ReverseIterator pRev = new ReverseIterator(pGONode.poGameObject);

                    //need to update the children 1st then work our way back up the tree
                    // So depth first(ReverseIterator)
                    // maintaines integrity of the bounding collision rectangles
                    Component pNode = pRev.First();
                    while (!pRev.IsDone())
                    {
                        GameObject pGameObj = (GameObject)pNode;

                        //Debug.WriteLine("update: {0} ({1})", pGameObj, pGameObj.GetHashCode());
                        pGameObj.Update();

                        pNode = pRev.Next();
                    }
                    //Debug.WriteLine("   ------");
                    pGONode = (GONode)pGONode.pNext;
                }
            }
        }
Пример #9
0
        public static void Update()
        {
            Debug.Assert(pMan != null);

            GameObjectNode pGameObjectNode = (GameObjectNode)pMan.poActive;

            while (pGameObjectNode != null)
            {
                ReverseIterator pRev = new ReverseIterator(pGameObjectNode.pGamObj);

                Component pNode = pRev.First();
                while (!pRev.IsDone())
                {
                    GameObject pGameObj = (GameObject)pNode;

                    //   Debug.WriteLine("update: {0} ({1})", pGameObj, pGameObj.GetHashCode());
                    pGameObj.Update();

                    pNode = pRev.Next();
                }

                pGameObjectNode = (GameObjectNode)pGameObjectNode.pNext;
            }
        }
Пример #10
0
        public static void Update()
        {
            GameObjectManager pMan = GameObjectManager.privGetInstance();

            //get the root game object
            GameObjectNode pRoot = (GameObjectNode)pMan.baseGetActive();

            while (pRoot != null)
            {
                // OK at this point, I have a Root tree,
                // need to walk the tree completely before moving to next tree

                //todo double check on forward or reverse iteration
                //PCSTreeIterator pIterator = new PCSTreeIterator(pRoot.pGameObj);
                PCSTreeForwardIterator pIterator = new PCSTreeForwardIterator(pRoot.pGameObj);
                //PCSTreeReverseIterator pIterator = new PCSTreeReverseIterator(pRoot.pGameObj);


                // Initialize the first game object pointer
                GameObject pGameObj = (GameObject)pIterator.First();

                //iterate through and update all GameObjects in this tree/subtree
                //Debug.WriteLine("-------");
                while (!pIterator.IsDone())
                {
                    //Debug.WriteLine("  {0}", pGameObj.GetName());
                    pGameObj.Update();

                    // Advance
                    pGameObj = (GameObject)pIterator.Next();
                }

                // Go to next tree
                pRoot = (GameObjectNode)pRoot.pMNext;
            }
        }
Пример #11
0
        public static void Remove(GameObject pNode)
        {
            // Keenan(delete.E)
            Debug.Assert(pNode != null);
            GameObjectManager pMan = GameObjectManager.pActiveManager;

            Debug.Assert(pMan != null);

            GameObject pSafetyNode = pNode;

            // OK so we have a linked list of trees (Remember that)

            // 1) find the tree root (we already know its the most parent)

            GameObject pTmp  = pNode;
            GameObject pRoot = null;

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

            // 2) pRoot is the tree we are looking for
            // now walk the active list looking for pRoot

            GameObjectNode pTree = (GameObjectNode)pMan.baseGetActive();

            while (pTree != null)
            {
                if (pTree.poGameObj == pRoot)
                {
                    // found it
                    break;
                }
                // Goto Next tree
                pTree = (GameObjectNode)pTree.pNext;
            }

            // 3) pTree is the tree that holds pNode
            //  Now remove the node from that tree

            Debug.Assert(pTree != null);
            Debug.Assert(pTree.poGameObj != null);

            // Is pTree.poGameObj same as the node we are trying to delete?
            // Answer: should be no... since we always have a group (that was a good idea)

            Debug.Assert(pTree.poGameObj != pNode);

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

            Debug.Assert(pParent != null);

            // Make sure there is no child before the delete
            GameObject pChild = (GameObject)Iterator.GetChild(pNode);

            Debug.Assert(pChild == null);

            // remove the node
            pParent.Remove(pNode);

            // FOUND the bug!!!!
            pParent.Update();

            // TODO - Recycle pNode
        }
Пример #12
0
 public void Update()
 {
     GameObj.Update();
 }