Пример #1
0
        /// <summary>
        /// 开始掉落随机的道具
        /// </summary>
        /// <returns></returns>
        public GoldItem[] GenerateGoldLoot()
        {
            if (m_GoldLoots == null)
            {
                return(null);
            }

            List <GoldItem> treasureList = new List <GoldItem>(OneTreasure.DROP_CACHED_SIZE);

            for (int iIndex = 0; iIndex < m_Loots.Length; iIndex++)
            {
                OneTreasure oneTreasure = m_Loots[iIndex];
                if (oneTreasure.IsDrop())
                {
                    GoldItem[] goldItemArray = oneTreasure.RandomGoldDrop();
                    if (goldItemArray != null)
                    {
                        treasureList.AddRange(goldItemArray);
                    }
                }
            }

            return(treasureList.ToArray());
        }
Пример #2
0
        /// <summary>
        /// 开始掉落随机的道具
        /// </summary>
        /// <returns></returns>
        public ItemT[] GenerateLoot <ItemT>() where ItemT : BaseItem
        {
            if (m_Loots == null)
            {
                return(null);
            }

            List <ItemT> treasureList = new List <ItemT>(OneTreasure.DROP_CACHED_SIZE);

            for (int iIndex = 0; iIndex < m_Loots.Length; iIndex++)
            {
                OneTreasure oneTreasure = m_Loots[iIndex];
                if (oneTreasure.IsDrop() == true)
                {
                    ItemT[] itemArray = oneTreasure.RandomDrop <ItemT>();
                    if (itemArray != null)
                    {
                        treasureList.AddRange(itemArray);
                    }
                }
            }

            return(treasureList.ToArray());
        }