本文整理匯總了C#中Server.Engines.CannedEvil.ChampionSpawn.IsEligible方法的典型用法代碼示例。如果您正苦於以下問題:C# ChampionSpawn.IsEligible方法的具體用法?C# ChampionSpawn.IsEligible怎麽用?C# ChampionSpawn.IsEligible使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Server.Engines.CannedEvil.ChampionSpawn
的用法示例。
在下文中一共展示了ChampionSpawn.IsEligible方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: GETCHAMPREWARDMOB
public static Mobile GETCHAMPREWARDMOB(TriggerObject trigObject, ChampionSpawn champSpawn, bool removeFromList)
{
if (champSpawn == null)
{
return null;
}
var scores = champSpawn.Scores;
if (scores == null)
{
return null;
}
Mobile value = null;
// first find all eligible receivers
var eligibleMobs = new List<Mobile>();
var eligibleMobScores = new List<double>();
double totalScores = 0.0;
foreach (var pair in scores)
{
if (pair.Key == null)
{
continue;
}
Mobile mob = pair.Key;
bool eligible = champSpawn.IsEligible(mob);
if (!eligible)
{
continue;
}
eligibleMobs.Add(mob);
eligibleMobScores.Add(pair.Value);
totalScores += pair.Value;
}
double currentTestValue = 0.0;
double roll = Utility.RandomDouble() * totalScores;
for (int i = 0; i < eligibleMobScores.Count; i++)
{
currentTestValue += eligibleMobScores[i];
if (!(roll <= currentTestValue))
{
continue;
}
value = eligibleMobs[i];
break;
}
if (value != null && removeFromList)
{
scores.Remove(value);
}
return value;
}