Exemplo n.º 1
0
        public void Items(ref MyPhysObjectSmallShipConfigItem[] items)
        {
            if (items.Length < m_items.Length)
            {
                items = new MyPhysObjectSmallShipConfigItem[m_items.Length];
            }

            int count = 0;

            foreach (var item in m_items)
            {
                items[count] = item.Enable ? item : null;
                count++;
            }
        }
Exemplo n.º 2
0
        public void Items(ref MyPhysObjectSmallShipConfigItem[] items)
        {
            if (items.Length < m_items.Length)
            {
                items = new MyPhysObjectSmallShipConfigItem[m_items.Length];
            }

            int count = 0;
            foreach (var item in m_items)
            {
                items[count] = item.Enable ? item : null;
                count++;
            }

        }
Exemplo n.º 3
0
        public void Items(int first, ref MyPhysObjectSmallShipConfigItem[] items, ref int count)
        {
            int enabledCount = 0;
            foreach (var item in m_items) if (item.Enable) ++enabledCount;

            // Try get as much items as possible
            int last = Math.Max(enabledCount - items.Length, 0);
            if (last < first)
            {
                first = last;
            }

            count = 0;
            foreach (var item in m_items)
            {
                if (!item.Enable) continue;
                if (first <= count && items.Length > count - first)
                {
                    items[count - first] = item;
                }
                count++;
            }

            for (int i = count - first; i < items.Length; i++)
            {
                items[i] = null;
            }
        }