public void Process() { CollisionObserver pNode = this.head; while (pNode != null) { // Fire off listener pNode.ExecuteDelayed(); pNode = (CollisionObserver)pNode.GetNext(); } // remove pNode = this.head; CollisionObserver pTmp = null; while (pNode != null) { pTmp = pNode; pNode = (CollisionObserver)pNode.GetNext(); // remove this.PrivDetach(pTmp, ref this.head); } }
private void PrivDetach(CollisionObserver node, ref CollisionObserver head) { // protection Debug.Assert(node != null); if (node.GetPrev() != null) { // middle or last node node.GetPrev().SetNext(node.GetNext()); } else { // first head = (CollisionObserver)node.GetNext(); } if (node.GetNext() != null) { // middle node node.GetNext().SetPrev(node.GetPrev()); } }
public void Notify() { CollisionObserver pNode = this.pHead; while (pNode != null) { // Fire off listener pNode.Notify(); pNode = (CollisionObserver)pNode.GetNext(); } }