public static void Update() { GameObjectMan pMan = GameObjectMan.privGetInstance(); Debug.Assert(pMan != null); // Debug.WriteLine("---------------"); GameObjectNode pGameObjectNode = (GameObjectNode)pMan.baseGetActive(); while (pGameObjectNode != null) { ReverseIterator pRev = new ReverseIterator(pGameObjectNode.poGameObj); Component pNode = pRev.First(); while (!pRev.IsDone()) { GameObject pGameObj = (GameObject)pNode; pGameObj.Update(); pNode = pRev.Next(); } pGameObjectNode = (GameObjectNode)pGameObjectNode.pNext; } }
public static void SetActive(GameObjectMan pGOMan) { GameObjectMan pMan = GameObjectMan.privGetInstance(); Debug.Assert(pMan != null); Debug.Assert(pGOMan != null); GameObjectMan.pActiveGOMan = pGOMan; }
public static GameObjectNode Attach(GameObject pGameObject) { GameObjectMan pMan = GameObjectMan.privGetInstance(); Debug.Assert(pMan != null); GameObjectNode pNode = (GameObjectNode)pMan.baseAdd(); Debug.Assert(pNode != null); pNode.Set(pGameObject); return(pNode); }
public static void Remove(GameObject pNode) { Debug.Assert(pNode != null); GameObjectMan pMan = GameObjectMan.privGetInstance(); GameObject pSafetyNode = pNode; GameObject pTmp = pNode; GameObject pRoot = null; while (pTmp != null) { pRoot = pTmp; pTmp = (GameObject)Iterator.GetParent(pTmp); } GameObjectNode pTree = (GameObjectNode)pMan.baseGetActive(); while (pTree != null) { if (pTree.poGameObj == pRoot) { break; } pTree = (GameObjectNode)pTree.pNext; } Debug.Assert(pTree != null); Debug.Assert(pTree.poGameObj != null); if (pTree.poGameObj == pNode) { return; } Debug.Assert(pTree.poGameObj != pNode); GameObject pParent = (GameObject)Iterator.GetParent(pNode); Debug.Assert(pParent != null); GameObject pChild = (GameObject)Iterator.GetChild(pNode); Debug.Assert(pChild == null); pParent.Remove(pNode); pParent.Update(); // TODO - Recycle pNode }
public static GameObject Find(GameObject.Name name) { GameObjectMan pMan = GameObjectMan.privGetInstance(); Debug.Assert(pMan != null); // Compare functions only compares two Nodes pMan.poNodeCompare.poGameObj.name = name; GameObjectNode pNode = (GameObjectNode)pMan.baseFind(pMan.poNodeCompare); Debug.Assert(pNode != null); return(pNode.poGameObj); }