コード例 #1
0
        public static void Update()
        {
            //GameObjectMan pMan = GameObjectMan.privGetInstance();
            GameObjectMan pMan = GameObjectMan.pActiveGOMan;

            Debug.Assert(pMan != null);

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

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

                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;
            }
        }
コード例 #2
0
        public static void Update()
        {
            GameObjectManager pMan = GameObjectManager.pActiveManager;

            Debug.Assert(pMan != null);

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

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

            while (pGameObjectNode != null)
            {
                // Debug.WriteLine("update: GameObjectTree {0} ({1})", pGameObjectNode.poGameObj, pGameObjectNode.poGameObj.GetHashCode());
                // Debug.WriteLine("   +++++");
                ReverseIterator pRev = new ReverseIterator(pGameObjectNode.poGameObj);

                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("   ------");
                pGameObjectNode = (GameObjectNode)pGameObjectNode.pNext;
            }
        }
コード例 #3
0
        public static void Update()
        {
            GameObjectMan pMan = GameObjectMan.PrivGetInstance();

            Debug.Assert(pMan != null);

            GameObjectNode pGameObjectNode = (GameObjectNode)pMan.BaseGetActive();

            while (pGameObjectNode != null)
            {
                //Debug.WriteLine("update: GameObjectTree {0} ({1})", pGameObjectNode.pGameObj, pGameObjectNode.pGameObj.GetHashCode());
                //Debug.WriteLine("   +++++");
                // Need to rework GameObjectMan to only use Components
                ReverseIterator pRev = new ReverseIterator(pGameObjectNode.pGameObj);

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

                    pNode = pRev.Next();
                }

                pGameObjectNode = (GameObjectNode)pGameObjectNode.pNext;
            }
        }
コード例 #4
0
ファイル: GameObjectMan.cs プロジェクト: xfanw/Game
 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();
     }
 }
コード例 #5
0
        private void MoveDonw()
        {
            GameObject pAlienGroup = GameObjectMan.Find(GameObject.Name.AlienGroup);

            ReverseIterator pRev  = new ReverseIterator(pAlienGroup);
            Component       pNode = pRev.First();

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

                float nextPosY = pGameObj.GetY() - 20;

                pGameObj.SetXY(pGameObj.GetX(), nextPosY);

                pNode = pRev.Next();
            }
        }
コード例 #6
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;
                }
            }
        }
コード例 #7
0
ファイル: AlienGroup.cs プロジェクト: Carsonq/SpaceInvaders
        public override void Move(float speedX, float speedY)
        {
            ReverseIterator pRev  = new ReverseIterator(this);
            Component       pNode = pRev.First();

            while (!pRev.IsDone())
            {
                GameObject pGameObj = (GameObject)pNode;
                if (pGameObj.holder == Container.LEAF)
                {
                    this.DropBomb(pGameObj);
                }

                float nextPosX = pGameObj.GetX() + (speedX * AlienGroup.moveDirectionX);
                //float nextPosY = pGameObj.GetY() + (speedY * AlienGroup.moveDirectionY);
                pGameObj.SetXY(nextPosX, pGameObj.GetY());

                pNode = pRev.Next();
            }

            //AlienGroup.moveDirectionY = 0;
        }