public void CreateNewNode(GameObject gameObject, Node current) { Node newNode = new Node(gameObject); current.nextNode.previousNode = newNode; newNode.nextNode = current.nextNode; newNode.previousNode = current; current.nextNode = newNode; }
public Node DeleteAt(int ID) { Node currentNode = mFirstNode; // start at first node while (currentNode.gameObject.mObjectID != ID) { currentNode = currentNode.nextNode; // Move to next link if (currentNode == null) { // Print to debug line here: // This means the object we are trying to delete, was never added // to the global list of in play objects. return null; } } //Console.WriteLine(currentNode.gameObject.Sprite.AssetName); currentNode.gameObject = null; //Console.WriteLine(currentNode.gameObject); if (currentNode == mFirstNode) //Found it on first try { mFirstNode = currentNode.nextNode; } else { currentNode.previousNode.nextNode = currentNode.nextNode; } if (currentNode == mLastNode) // Found it on last node { mLastNode = currentNode.previousNode; } else { currentNode.nextNode.previousNode = currentNode.previousNode; } mCount--; return currentNode; }
public GameObject DeleteFirst() { GameObject tempGameObject = mFirstNode.gameObject; if (mFirstNode.nextNode == null) { mLastNode = null; } mFirstNode = mFirstNode.nextNode; mCount--; return tempGameObject; }
public JLinkedList() { mFirstNode = null; mLastNode = null; mCount = 0; }
public JTargetQueue() { mTargetList = new JLinkedList(); mCount = 0; mCurrent = null; }
public void Reset() { mCurrent = mFirstNode; mPreviousNode = null; }
public void NextNode() { if (GameObject.mPotentialTargetListList.GetCount() > 3) { } try { mPreviousNode = mCurrent; mCurrent = mCurrent.nextNode; } catch (Exception e) { } }
public void InsertLast(GameObject gameObject) { Node newNode = new Node(gameObject); if (IsEmpty()) { mFirstNode = newNode; // FirstNode == new Node } else { mLastNode.nextNode = newNode; // oldLastNode ---> newNode newNode.previousNode = mLastNode; // previousNode ---> LastNode } mLastNode = newNode; // NewLink <---last mCount++; }
public void InsertFirst(GameObject gameObject) { Node newNode = new Node(gameObject); if (IsEmpty()) { mLastNode = newNode; } else { mFirstNode.previousNode = newNode; // newNode <----- oldFirstNode } newNode.nextNode = mFirstNode; // newNode ------>oldFirstNode mFirstNode = newNode; // FirstNode ----> newNode mCount++; }