// PRAGMA MARK - Static public static ILootReward[] SelectRewardsForLootDropGroupId(int lootDropGroupId) { List <ILootReward> rewards = new List <ILootReward>(); LootDropGroup dropGroup = IdList <LootDropGroup> .Instance.LoadById(lootDropGroupId); int selectedLootDropId = WeightedSelectionUtil.SelectWeightedObject(dropGroup.dropList).lootDropId; IIdList <LootDrop> lootDropList = ListFactory <LootDrop> .Instance.GetList(); LootDrop selectedLootDrop = lootDropList.LoadById(selectedLootDropId); if (selectedLootDrop == null) { Debug.LogError("SelectRewardsForLootDropGroupId: failed to select lootDrop with group id: " + lootDropGroupId); return(null); } foreach (int rewardedLootDropGroupId in selectedLootDrop.rewardedLootDropGroupIds) { rewards.AddRange(LootManager.SelectRewardsForLootDropGroupId(rewardedLootDropGroupId)); } rewards.AddRange(selectedLootDrop.RewardedLootRewards); return(rewards.ToArray()); }
// PRAGMA MARK - Static public static TEntity SelectWeightedObject <TEntity>(IEnumerable <TEntity> collection) where TEntity : DTEntity { return(WeightedSelectionUtil.SelectWeightedObject(collection, WeightedSelectionSystem.GetWeightForEntity)); }