コード例 #1
0
        public static void Remove(GameObjectNode pNode)
        {
            GameObjectManager pMan = GameObjectManager.pActiveMan;

            Debug.Assert(pMan != null);

            Debug.Assert(pNode != null);
            pMan.BaseRemove(pNode);
        }
コード例 #2
0
        private GameObjectManager()
            : base()
        {
            GameObjectManager.pActiveMan = null;

            GameObjectManager.poNodeCompare          = new GameObjectNode();
            GameObjectManager.poNullGameObject       = new NullGameObject();
            GameObjectManager.poNodeCompare.pGameObj = GameObjectManager.poNullGameObject;
        }
コード例 #3
0
        public static void Remove(GameObjectNode pNode)
        {
            GameObjectMan pMan = GameObjectMan.PrivGetInstance();

            Debug.Assert(pMan != null);

            Debug.Assert(pNode != null);
            pMan.BaseRemove(pNode);
        }
コード例 #4
0
ファイル: GameObjectManager.cs プロジェクト: wangjo22/Final
        public static GameObjectNode Attach(GameObject pGameObject)
        {
            Debug.Assert(pInstance != null);

            GameObjectNode pNode = (GameObjectNode)pInstance.BaseAdd();

            Debug.Assert(pNode != null);
            pNode.Set(pGameObject);
            return(pNode);
        }
コード例 #5
0
ファイル: GameObjectManager.cs プロジェクト: wangjo22/Final
        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);
        }
コード例 #6
0
        //----------------------------------------------------------------------
        // 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());
        }
コード例 #7
0
        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);
        }
コード例 #8
0
        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());
        }
コード例 #9
0
        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);
        }
コード例 #10
0
        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;
        }
コード例 #11
0
        //----------------------------------------------------------------------------------
        // 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;
        }
コード例 #12
0
        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);
        }
コード例 #13
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);
        }
コード例 #14
0
        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);
        }
コード例 #15
0
        public static GameObjectNode Attach(GameObject pObj)
        {
            Debug.Assert(pMan != null);

            GameObjectNode pGameObject = (GameObjectNode)pMan.baseAdd();

            Debug.Assert(pGameObject != null);



            pGameObject.Set(pObj);
            return(pGameObject);
        }
コード例 #16
0
        //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);
        }
コード例 #17
0
        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;
        }
コード例 #18
0
        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);
        }
コード例 #19
0
        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);
        }
コード例 #20
0
        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());
        }
コード例 #21
0
        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
        }
コード例 #22
0
        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);
        }
コード例 #23
0
        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);
        }
コード例 #24
0
        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);
        }
コード例 #25
0
        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());
        }
コード例 #26
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();
     }
 }
コード例 #27
0
        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);
        }
コード例 #28
0
        //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);
        }
コード例 #29
0
        //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);
        }
コード例 #30
0
        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);
        }