Exemple #1
0
    void CreateDroppableItemList()
    {
        if (_itemListsUpdated)
        {
            return;
        }

        _itemListsUpdated = true;

        //_itemLists.Add(this); // this will be added at the end of this method(foreach)

        Pathea.PeEntity entity = GetComponent <Pathea.PeEntity>();
        if (null == entity)
        {
            return;
        }
        _skAlive = entity.GetCmpt <Pathea.SkAliveEntity>();
        if (_skAlive == null || !_skAlive.isDead)
        {
            return;
        }

        if (Pathea.PeGameMgr.IsMulti)
        {
            return;
        }
        Pathea.CommonCmpt common = entity.GetCmpt <Pathea.CommonCmpt>();
        if (common != null)
        {
            List <ItemSample> items = ItemDropData.GetDropItems(common.ItemDropId);
            if (common.entityProto.proto == Pathea.EEntityProto.Monster)
            {
                if (items == null)
                {
                    items = GetSpecialItem.MonsterItemAdd(common.entityProto.protoId);
                }
                else
                {
                    items.AddRange(GetSpecialItem.MonsterItemAdd(common.entityProto.protoId));   //特殊道具添加
                }
            }
            if (items != null)
            {
                foreach (ItemSample item in items)
                {
                    AddDroppableItem(item);
                }
            }
        }

        return;
    }
Exemple #2
0
    public void RequestCreateLootItem(PeEntity entity)
    {
        if (null == entity)
        {
            return;
        }
        if (PeGameMgr.IsMulti)
        {
            return;
        }

        CommonCmpt common = entity.commonCmpt;

        if (common != null)
        {
            List <ItemSample> items = ItemDropData.GetDropItems(common.ItemDropId);
            if (common.entityProto.proto == EEntityProto.Monster)
            {
                if (items == null)
                {
                    items = GetSpecialItem.MonsterItemAdd(common.entityProto.protoId);
                }
                else
                {
                    items.AddRange(GetSpecialItem.MonsterItemAdd(common.entityProto.protoId));                       //特殊道具添加
                }
            }
            if (items != null)
            {
                for (int i = 0; i < items.Count; ++i)
                {
                    AddLootItem(entity.position, items[i].protoId, items[i].stackCount);
                }
            }
        }
    }