public static void Remove(GameObjectNode pNode) { GameObjectManager pMan = GameObjectManager.pActiveMan; Debug.Assert(pMan != null); Debug.Assert(pNode != null); pMan.BaseRemove(pNode); }
private GameObjectManager() : base() { GameObjectManager.pActiveMan = null; GameObjectManager.poNodeCompare = new GameObjectNode(); GameObjectManager.poNullGameObject = new NullGameObject(); GameObjectManager.poNodeCompare.pGameObj = GameObjectManager.poNullGameObject; }
public static void Remove(GameObjectNode pNode) { GameObjectMan pMan = GameObjectMan.PrivGetInstance(); Debug.Assert(pMan != null); Debug.Assert(pNode != null); pMan.BaseRemove(pNode); }
public static GameObjectNode Attach(GameObject pGameObject) { Debug.Assert(pInstance != null); GameObjectNode pNode = (GameObjectNode)pInstance.BaseAdd(); Debug.Assert(pNode != null); pNode.Set(pGameObject); return(pNode); }
public static GameObject Find(GameObject.Name name) { Debug.Assert(pInstance != null); pInstance.poNodeCompare.pGameObject.name = name; GameObjectNode pNode = (GameObjectNode)pInstance.BaseFind(pInstance.poNodeCompare); Debug.Assert(pNode != null); return(pNode.pGameObject); }
//---------------------------------------------------------------------- // Override Abstract methods //---------------------------------------------------------------------- protected override bool derivedCompare(DLink pNodeA, DLink pNodeB) { Debug.Assert(pNodeA != null); Debug.Assert(pNodeB != null); GameObjectNode pDataA = (GameObjectNode)pNodeA; GameObjectNode pDataB = (GameObjectNode)pNodeB; return(pDataA.getGameObject().getName() == pDataB.getGameObject().getName()); }
public static void Remove(GameObjectNode pNode) { //ensure call Create() first GameObjectMan pMan = GameObjectMan.GetInstance(); Debug.Assert(pMan != null); Debug.Assert(pMan != null); pMan.baseRemove(pNode); }
override protected Boolean DerivedCompare(DLink pLinkA, DLink pLinkB) { Debug.Assert(pLinkA != null); Debug.Assert(pLinkB != null); GameObjectNode pDataA = (GameObjectNode)pLinkA; GameObjectNode pDataB = (GameObjectNode)pLinkB; return(pDataA.GetGameObj().GetName() == pDataB.GetGameObj().GetName()); }
public static void Remove(GameObjectNode pNode) { //GameObjectMan pMan = GameObjectMan.privGetInstance(); GameObjectMan pMan = GameObjectMan.pActiveGOMan; Debug.Assert(pMan != null); Debug.Assert(pNode != null); pMan.baseRemove(pNode); }
private GameObjectManager(int numNodes = 3, int growthSize = 1) : base(numNodes, growthSize) { poNodeCompare = new GameObjectNode(); Debug.Assert(poNodeCompare != null); this.poNullGameObject = new NullGameObject(); Debug.Assert(poNullGameObject != null); this.poNodeCompare.pGameObj = this.poNullGameObject; }
//---------------------------------------------------------------------------------- // Constructor //---------------------------------------------------------------------------------- public GameObjectManager(int initReserve = 3, int growthRate = 1) : base() { // abstract manager fields this.baseInitialize(initReserve, growthRate); //class fields this.poNullGameObject = new NullGameObject(); this.poNodeCompare = new GameObjectNode(); this.poNodeCompare.poGameObj = this.poNullGameObject; }
protected override bool Compare(DLink dLink1, DLink dLink2) { bool result = false; GameObjectNode goNode1 = (GameObjectNode)dLink1; GameObjectNode goNode2 = (GameObjectNode)dLink2; if (goNode1.pGameObject.gameObjectName == goNode2.pGameObject.gameObjectName) { result = true; } return(result); }
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); }
public static GameObjectNode Attach(GameObject pGameObject) { GameObjectManager pMan = GameObjectManager.PrivGetInstance(); Debug.Assert(pMan != null); GameObjectNode pNode = (GameObjectNode)pMan.BaseAdd(); Debug.Assert(pNode != null); pNode.Set(pGameObject); return(pNode); }
public static GameObjectNode Attach(GameObject pObj) { Debug.Assert(pMan != null); GameObjectNode pGameObject = (GameObjectNode)pMan.baseAdd(); Debug.Assert(pGameObject != null); pGameObject.Set(pObj); return(pGameObject); }
//public static GameObjectNode AttachTree(GameObject pGameObject, PCSTree pTree) //{ // //safety first // Debug.Assert(pGameObject != null); // GameObjectManager pMan = GameObjectManager.privGetInstance(); // Debug.Assert(pMan != null); // GameObjectNode pNode = (GameObjectNode)pMan.baseAddToFront(); // Debug.Assert(pNode != null); // Debug.Assert(pTree != null); // pNode.Set(pGameObject, pTree); // return pNode; //} public static GameObjectNode AttachTree(GameObject pGameObject) { Debug.Assert(pGameObject != null); GameObjectManager pMan = GameObjectManager.privGetInstance(); GameObjectNode pNode = (GameObjectNode)pMan.baseAddToFront(); Debug.Assert(pNode != null); pNode.Set(pGameObject); return(pNode); }
public static void Destroy() { // Get the instance GameObjectManager pMan = GameObjectManager.privGetInstance(); #if (TRACK_DESTRUCTOR) Debug.WriteLine("--->GameObjectMan.Destroy()"); #endif pMan.baseDestroy(); GameObjectManager.pRefNode = null; GameObjectManager.pInstance = null; }
public static GameObjectNode Attach(GameObject pGameObject) { //ensure call Create() first GameObjectMan pMan = GameObjectMan.GetInstance(); Debug.Assert(pMan != null); GameObjectNode pNode = (GameObjectNode)pMan.baseAdd(); Debug.Assert(pNode != null); pNode.set(pGameObject); return(pNode); }
public static GameObjectNode Attach(GameObject pGameObject) { //GameObjectMan pMan = GameObjectMan.privGetInstance(); GameObjectMan pMan = GameObjectMan.pActiveGOMan; Debug.Assert(pMan != null); GameObjectNode pNode = (GameObjectNode)pMan.baseAdd(); Debug.Assert(pNode != null); pNode.Set(pGameObject); return(pNode); }
protected override bool derivedCompare(DLink pLinkA, DLink pLinkB) { //This is called by baseFind Debug.Assert(pLinkA != null); Debug.Assert(pLinkB != null); //Cast to type GameObjectNode pGameObjA = (GameObjectNode)pLinkA; GameObjectNode pGameObjB = (GameObjectNode)pLinkB; // result of comparison, expression results a bool return(pGameObjA.poGameObj.GetName() == pGameObjB.poGameObj.GetName()); }
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 GameObjectNode Attach(GameObject pGameOject) { GameObjectManager pMan = GameObjectManager.pActiveManager; Debug.Assert(pMan != null); //grab a DLink GameObjectNode pNode = (GameObjectNode)pMan.baseAdd(); Debug.Assert(pNode != null); //initialize pNode.Set(pGameOject); return(pNode); }
public static GameObject Find(GameObject.Name theName) { GameObjectManager pMan = GameObjectManager.pActiveManager; Debug.Assert(pMan != null); // set common compare node, static object ref pMan.poNodeCompare.poGameObj.SetName(theName); //find and return ref GameObjectNode pNode = (GameObjectNode)pMan.baseFind(pMan.poNodeCompare); Debug.Assert(pNode != null); return(pNode.poGameObj); }
public static GameObject Find(GameObject.Name name) { GameObjectManager pMan = GameObjectManager.PrivGetInstance(); Debug.Assert(pMan != null); // Compare functions only compares two Nodes pMan.poNodeCompare.pGameObj.name = name; GameObjectNode pNode = (GameObjectNode)pMan.BaseFind(pMan.poNodeCompare); Debug.Assert(pNode != null); return(pNode.pGameObj); }
public static GameObject Find(GameObject.Name name) { //ensure call Create() first GameObjectMan pMan = GameObjectMan.GetInstance(); Debug.Assert(pMan != null); pMan.poNodeForCompare.getGameObject().setName(name); GameObjectNode pNode = (GameObjectNode)pMan.baseFind(pMan.poNodeForCompare); Debug.Assert(pNode != null); return(pNode.getGameObject()); }
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(); } }
protected override bool compareConcreteNode(ref MLink targetNode, ref MLink currNode) { Debug.Assert(targetNode != null); Debug.Assert(currNode != null); bool result = false; GameObjectNode targetObjNode = (GameObjectNode)targetNode; GameObjectNode currObjNode = (GameObjectNode)currNode; if (targetObjNode.getGameObject().getName().Equals(currObjNode.getGameObject().getName())) { result = true; } return(result); }
//changed public static GameObjectNode add(GameObject mGameObj, PCSTree mTree) { Debug.Assert(mGameObj != null); Debug.Assert(mTree != null); GameObjectNodeManager goNInstance = GameObjectNodeManager.getSingletonInstance(); Debug.Assert(gamMInstance != null); GameObjectNode goNode = (GameObjectNode)gamMInstance.genericAdd(); Debug.Assert(goNode != null); goNode.set(mGameObj, mTree); return(goNode); }
//only composites!! public static GameObjectNode Attach(GameObject pGameObject) { Debug.Assert(pGameObject != null); Debug.Assert(pGameObject.holder == Component.Container.COMPOSITE); GameObjectManager pMan = GameObjectManager.pActiveMan; 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); //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); }