Exemplo n.º 1
0
        public void add(ISystem system, int priority)
        {
            priority = priority == -1 ? system.defaultPriority : priority;
            Debug.Assert(priority != -1);

            SystemNode newNode = new SystemNode(system, priority);
            if (_head == null)
            {
                _head = newNode;
            }
            else
            {
                int countBefore = count;

                SystemNode current = _head;
                while (current.next != null)
                {
                    if (current.next.priority > priority)
                    {
                        break;
                    }
                    current = current.next;
                }
                current.insert(newNode);

                int countAfter = count;
                Debug.Assert(countAfter == countBefore + 1);
            }
            Logger.log(string.Format("Added {0} system to SystemManager.", system.systemType));
        }
Exemplo n.º 2
0
 public void insert(SystemNode node)
 {
     if (_next != null)
     {
         _next.previous = node;
     }
     node.previous = this;
     node.next = _next;
     _next = node;
 }
Exemplo n.º 3
0
 public void remove()
 {
     if (_previous != null)
     {
         _previous.next = _next;
     }
     if (_next != null)
     {
         _next.previous = _previous;
     }
     _previous = null;
     _next = null;
     _system = null;
 }