Ejemplo n.º 1
0
        private static SparePartProperty RandomAbilityProperty(SparePartInfo partInfo, CacheList <SparePartProperty> ignorePropertys)
        {
            var tempPropertys = new List <SparePartProperty>();

            foreach (var property in partInfo.PropertyRange)
            {
                if (ignorePropertys != null &&
                    ignorePropertys.Exists(m => m != null && m.AbilityType.Equals(property.AbilityType))
                    )
                {
                    continue;
                }
                tempPropertys.Add(property);
            }
            int index = RandomUtils.GetRandom(0, tempPropertys.Count);

            return(index < tempPropertys.Count ? tempPropertys[index] : null);
        }
Ejemplo n.º 2
0
    EntityBase Spawn(PoolController pool, Vector3 spawnPos, Quaternion spawnRot, GenericParams parms)
    {
        var spawned = pool.Spawn(data.entityRef, data.entityRef, spawnTo, spawnPos, spawnRot, null);

        var entity = spawned.GetComponent <EntityBase>();

        if (entity && !mSpawnedEntities.Exists(entity))
        {
            mSpawnedEntities.Add(entity);
            EntityRegisterCallbacks(entity, true);
        }

        if (spawnCallback != null)
        {
            spawnCallback(this, entity);
        }

        return(entity);
    }
Ejemplo n.º 3
0
        private static void SetRandomItem(CacheList<MysteryShops> mysteryList, List<ItemType> itemList, DateTime nextDate)
        {
            foreach (ItemType itemType in itemList)
            {
                List<ItemBaseInfo> itemArray = new ConfigCacheSet<ItemBaseInfo>().FindAll(u => u.IsMystery == 1 && u.ItemType == itemType);
                if (itemArray.Count == 0)
                {
                    throw new Exception("刷新神秘商店出错:物品" + itemType + "类型不存在");
                }
                ItemBaseInfo itemInfo = itemArray[RandomUtils.GetRandom(0, itemArray.Count)];

                if (mysteryList.Exists(m => m.ItemID == itemInfo.ItemID))
                {
                    itemArray = new ConfigCacheSet<ItemBaseInfo>().FindAll(u => u.IsMystery == 1 && u.ItemID != itemInfo.ItemID && u.ItemType == itemType);
                    if (itemArray.Count == 0)
                    {
                        throw new Exception("刷新神秘商店出错:物品" + itemType + "类型不存在");
                    }
                    itemInfo = itemArray[RandomUtils.GetRandom(0, itemArray.Count)];
                }

                mysteryList.Add(new MysteryShops() { ItemID = itemInfo.ItemID, NextDate = nextDate, BuyNum = 0, ItemNum = itemInfo.MysteryNum });

            }
        }
Ejemplo n.º 4
0
 private static SparePartProperty RandomAbilityProperty(SparePartInfo partInfo, CacheList<SparePartProperty> ignorePropertys)
 {
     var tempPropertys = new List<SparePartProperty>();
     foreach (var property in partInfo.PropertyRange)
     {
         if (ignorePropertys != null
             && ignorePropertys.Exists(m => m != null && m.AbilityType.Equals(property.AbilityType))
            )
         {
             continue;
         }
         tempPropertys.Add(property);
     }
     int index = RandomUtils.GetRandom(0, tempPropertys.Count);
     return index < tempPropertys.Count ? tempPropertys[index] : null;
 }