示例#1
0
        protected override void derivedWashNode(MLink pLink)
        {
            Debug.Assert(pLink != null);
            GhostNode pNode = (GhostNode)pLink;

            pNode.WashNodeData();
        }
示例#2
0
        protected override MLink derivedCreateNode()
        {
            MLink pNode = new GhostNode();

            Debug.Assert(pNode != null);

            return(pNode);
        }
示例#3
0
        //----------------------------------------------------------------------
        // Constructor - Singleton Instantiation
        //----------------------------------------------------------------------
        private GhostManager(int startReserveSize = 3, int refillSize = 1)
            : base(startReserveSize, refillSize)
        {
            this.pRefNode = (GhostNode)this.derivedCreateNode();
            Debug.Assert(this.pRefNode != null);

            // Used only in compare
            this.pRefNode.pGameObj = new NullGameObject();
            Debug.Assert(this.pRefNode.pGameObj != null);
        }
示例#4
0
        //----------------------------------------------------------------------
        // 4 Wrapper methods: baseAdd, baseFind, baseRemove, baseDump
        //----------------------------------------------------------------------

        public static GhostNode Add(GameObject pGameObject)
        {
            GhostManager pMan = privGetInstance();

            Debug.Assert(pMan != null);

            GhostNode pNode = (GhostNode)pMan.baseAddToFront();

            Debug.Assert(pNode != null);

            // set the data
            pNode.Set(pGameObject);
            return(pNode);
        }
示例#5
0
        public static void Remove(GameObject pGameObject)
        {
            //get the singleton
            GhostManager pMan = privGetInstance();

            Debug.Assert(pMan != null);

            // Compare functions only compares two Nodes
            pMan.pRefNode.pGameObj.SetName(pGameObject.GetName());
            GhostNode pData = (GhostNode)pMan.baseFindNode(pMan.pRefNode);

            // release the resource
            pData.pGameObj = null;
            pMan.baseRemoveNode(pData);
        }
示例#6
0
        public static GameObject Find(GameObject.Name pGameObjectName)
        {
            //get the singleton
            GhostManager pMan = privGetInstance();

            Debug.Assert(pMan != null);
            // Compare functions only compares two Nodes

            // Compare functions only compares two Nodes
            pMan.pRefNode.pGameObj.SetName(pGameObjectName);

            GhostNode pData = (GhostNode)pMan.baseFindNode(pMan.pRefNode);

            Debug.Assert(pData != null);

            return(pData.pGameObj);
        }
示例#7
0
        //----------------------------------------------------------------------
        // Override Abstract methods
        //----------------------------------------------------------------------

        protected override Boolean derivedCompareNodes(MLink pLinkA, MLink pLinkB)
        {
            // This is used in baseFindNode()
            Debug.Assert(pLinkA != null);
            Debug.Assert(pLinkB != null);

            GhostNode pDataA = (GhostNode)pLinkA;
            GhostNode pDataB = (GhostNode)pLinkB;

            Boolean status = false;

            if (pDataA.GetName() == pDataB.GetName())
            {
                status = true;
            }

            return(status);
        }