Exemple #1
0
        public static void Remove(GameObject pNode)
        {
            Debug.Assert(pNode != null);
            GameObjectManager pMan        = GameObjectManager.GetInstance();
            GameObject        pSafetyNode = pNode;
            GameObject        pTmp        = pNode;
            GameObject        pRoot       = null;

            while (pTmp != null)
            {
                pRoot = pTmp;
                pTmp  = (GameObject)pTmp.pParent;
            }
            GameObjectNode pTree = (GameObjectNode)pMan.pActive;

            while (pTree != null)
            {
                if (pTree.pGameObject == pRoot)
                {
                    break;
                }
                pTree = (GameObjectNode)pTree.pDNext;
            }
            Debug.Assert(pTree != null);
            Debug.Assert(pTree.pGameObject != null);
            pMan.pRoot.SetRoot(pTree.pGameObject);
            pMan.pRoot.Remove(pNode);
        }
Exemple #2
0
        public static void Remove(GameObjectNode goNode)
        {
            Debug.Assert(goNode != null);
            GameObjectManager goMan = GameObjectManager.GetInstance();

            goMan.BaseRemove(goNode);
        }
Exemple #3
0
        public static GameObject Find(GameObjectName goName, int index = 0)
        {
            GameObjectManager goMan    = GameObjectManager.GetInstance();
            GameObjectNode    pRoot    = (GameObjectNode)goMan.pActive;
            GameObject        pGameObj = null;

            bool found = false;

            while (pRoot != null && found == false)
            {
                PCSTreeForwardIterator iter = new PCSTreeForwardIterator(pRoot.pGameObject);
                pGameObj = (GameObject)iter.First();

                while (!iter.IsDone())
                {
                    if ((pGameObj.gameObjectName == goName) && (pGameObj.index == index))
                    {
                        found = true;
                        break;
                    }
                    pGameObj = (GameObject)iter.Next();
                }
                pRoot = (GameObjectNode)pRoot.pDNext;
            }
            return(pGameObj);
        }
        public static void Dump()//BROKEN
        {
            GameObjectManager pMan = GameObjectManager.GetInstance();

            Debug.Assert(pMan != null);

            pMan.BaseDump();
        }
        public static void SetActive(GameObjectManager pSBMan)
        {
            GameObjectManager pMan = GameObjectManager.GetInstance();

            Debug.Assert(pMan != null);

            Debug.Assert(pSBMan != null);
            GameObjectManager.pActiveMan = pSBMan;
        }
Exemple #6
0
        public static GameObjectNode AttachTree(GameObject pGameObject)
        {
            Debug.Assert(pGameObject != null);
            GameObjectManager goMan = GameObjectManager.GetInstance();

            GameObjectNode goNode = (GameObjectNode)goMan.BaseAdd();

            Debug.Assert(goNode != null);

            goNode.Set(pGameObject);
            return(goNode);
        }
Exemple #7
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;
            }
        }
Exemple #8
0
        public static void Insert(GameObject pGameObject, GameObject pParent)
        {
            GameObjectManager goMan = GameObjectManager.GetInstance();

            Debug.Assert(pGameObject != null);

            if (pParent == null)
            {
                GameObjectManager.AttachTree(pGameObject);
            }
            else
            {
                Debug.Assert(pParent != null);

                goMan.pRoot.SetRoot(pParent);
                goMan.pRoot.Insert(pGameObject, pParent);
            }
        }
Exemple #9
0
        public static void Destroy()
        {
            GameObjectManager goMan = GameObjectManager.GetInstance();

            goMan.BaseDestroy();
        }
Exemple #10
0
        public static PCSTree GetRootTree()
        {
            GameObjectManager goMan = GameObjectManager.GetInstance();

            return(goMan.pRoot);
        }