本文整理汇总了C#中IPlayer.GetSource方法的典型用法代码示例。如果您正苦于以下问题:C# IPlayer.GetSource方法的具体用法?C# IPlayer.GetSource怎么用?C# IPlayer.GetSource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPlayer
的用法示例。
在下文中一共展示了IPlayer.GetSource方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetDesirability
public double GetDesirability(IPlayer player)
{
if (map.GetPlayerMe().GetBuildingCount(Building.Fort) == 0)
return 0.0;
int sum = 0;
int sourceHim;
int sourceMe;
ISourceAll source = player.GetSource();
IPlayer me = map.GetPlayerMe();
for (int loop1 = 0; loop1 < 5; loop1++)
{
sourceHim = source.Get((SourceKind)loop1);
sourceMe = me.GetCollectSourcesNormal().Get((SourceKind)loop1);
sum += (sourceMe <= 16) ? sourceHim * 2 : sourceHim;
}
double result = (sum - 2 * AIGen.SumVector(map.GetPrice(PriceKind.AStealSources).GetAsArray())) / 200.0;
if (result < 0.0)
result = 0.0;
else
if (result > 1.0)
result = 1.0;
return result;
}
示例2: GetFitness
public static float GetFitness(IPlayer player)
{
if (map.GetPlayerOthers().Count == 0)
return 0.0f;
int sum = 0;
int sourceHim;
int sourceMe;
ISourceAll source = player.GetSource();
IPlayer me = map.GetPlayerMe();
for (int loop1 = 0; loop1 < 5; loop1++)
{
sourceHim = source.Get((SourceKind)loop1);
sourceMe = me.GetCollectSourcesNormal().Get((SourceKind)loop1);
sum += (sourceMe <= 16) ? sourceHim * 2 : sourceHim;
}
float result = sum / 2000.0f;
if (result > 1.0f)
result = 1.0f;
return result;
}
示例3: HasPlayerSources
public Boolean HasPlayerSources(IPlayer player)
{
if (player == null)
return false;
ISourceAll sourcePlayer = player.GetSource();
return sourcePlayer.GetCorn() >= corn &&
sourcePlayer.GetMeat() >= meat &&
sourcePlayer.GetOre() >= ore &&
sourcePlayer.GetStone() >= stone &&
sourcePlayer.GetWood() >= wood;
}