Пример #1
0
        public GameEntityComponentLine(GameEntityComponent.UpdateLines updateLine)
        {
            m_updteLine = updateLine;

            m_head          = new GameEntityComponent(updateLine);
            m_tail          = new GameEntityComponent(updateLine);
            m_head.Next     = m_tail;
            m_tail.Previous = m_head;
        }
Пример #2
0
        /// <summary>
        /// Update all component of line
        /// </summary>
        /// <param name="dT">spend time [sec]</param>
        public void Update(double dT)
        {
            GameEntityComponent component = m_head.Next;

            while (component != m_tail)
            {
                component.Update(dT);
                component = component.Next;
            }
        }
Пример #3
0
        /// <summary>
        /// Add component to the tail of this line
        /// </summary>
        /// <param name="component">component (same UpdateLine)</param>
        /// <remarks>
        /// This method is called by GameEntityComponent only.
        /// </remarks>
        public void AddComponent(GameEntityComponent component)
        {
            Debug.Assert(component.UpdateLine == m_updteLine, "defferent update line");

            GameEntityComponent position = m_tail.Previous;

            position.Next      = component;
            component.Previous = position;

            component.Next  = m_tail;
            m_tail.Previous = component;
            m_count++;
        }
Пример #4
0
        /// <summary>
        /// Remove component from this line
        /// </summary>
        /// <param name="component">component (same UpdateLine)</param>
        /// <remarks>
        /// This method is called by GameEntityComponent only.
        /// </remarks>
        public void RemoveComponent(GameEntityComponent component)
        {
            Debug.Assert(component.UpdateLine == m_updteLine, "defferent update line");
            Debug.Assert(component.Next != null, "next component is null");
            Debug.Assert(component.Previous != null, "previous component is null");

            GameEntityComponent prev = component.Previous;
            GameEntityComponent next = component.Next;

            prev.Next          = next;
            next.Previous      = prev;
            component.Previous = null;
            component.Next     = null;
            m_count--;
        }
Пример #5
0
 public GameEntityComponent(UpdateLines updateLine)
 {
     m_updateLine = updateLine;
     Previous     = Next = null;
 }
Пример #6
0
 /// <summary>
 /// Add new component to entity
 /// </summary>
 /// <param name="component">new component</param>
 public void AddComponent(GameEntityComponent component)
 {
     m_components.Add(component);
     component.OnAddToEntity(this);
 }