protected override void derivedWashNode(MLink pLink) { Debug.Assert(pLink != null); GhostNode pNode = (GhostNode)pLink; pNode.WashNodeData(); }
protected override MLink derivedCreateNode() { MLink pNode = new GhostNode(); Debug.Assert(pNode != null); return(pNode); }
//---------------------------------------------------------------------- // 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 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); }
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); }
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); }
//---------------------------------------------------------------------- // 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); }