Example #1
0
        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;
        }
Example #2
0
        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;
        }
Example #3
0
        public GameObject DeleteFirst()
        {
            GameObject tempGameObject = mFirstNode.gameObject;

            if (mFirstNode.nextNode == null)
            {
                mLastNode = null;

            }

            mFirstNode = mFirstNode.nextNode;
            mCount--;
            return tempGameObject;
        }
Example #4
0
 public JLinkedList()
 {
     mFirstNode = null;
     mLastNode = null;
     mCount = 0;
 }
Example #5
0
 public JTargetQueue()
 {
     mTargetList = new JLinkedList();
     mCount = 0;
     mCurrent = null;
 }
Example #6
0
 public void Reset()
 {
     mCurrent = mFirstNode;
     mPreviousNode = null;
 }
Example #7
0
        public void NextNode()
        {
            if (GameObject.mPotentialTargetListList.GetCount() > 3)
            {

            }

            try
            {
                mPreviousNode = mCurrent;
                mCurrent = mCurrent.nextNode;
            }
            catch (Exception e)
            {

            }
        }
Example #8
0
        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++;
        }
Example #9
0
        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++;
        }