本文整理汇总了C#中GameObjects.Troop.GetHostileTroopsInView方法的典型用法代码示例。如果您正苦于以下问题:C# Troop.GetHostileTroopsInView方法的具体用法?C# Troop.GetHostileTroopsInView怎么用?C# Troop.GetHostileTroopsInView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GameObjects.Troop
的用法示例。
在下文中一共展示了Troop.GetHostileTroopsInView方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetCreditWithPosition
public override int GetCreditWithPosition(Troop source, out Point? position)
{
//position = 0;
position = new Point(0, 0);
TroopList hostileTroopsInView = source.GetHostileTroopsInView();
TroopList list2 = new TroopList();
foreach (Troop troop in hostileTroopsInView)
{
if ((troop.IsInArchitecture || !troop.DaysToReachPosition(source.Position, 1)) || (troop.Army.Kind.Type == MilitaryType.水军))
{
list2.Add(troop);
}
}
foreach (Troop troop in list2)
{
hostileTroopsInView.Remove(troop);
}
if (hostileTroopsInView.Count == 0)
{
return 0;
}
List<Point> orientations = new List<Point>();
int num = 0;
foreach (Troop troop in hostileTroopsInView)
{
orientations.Add(troop.Position);
num += troop.FightingForce;
}
int num2 = 0;
int fightingForce = source.FightingForce;
int num4 = source.TroopIntelligence + source.ChanceIncrementOfStratagem;
if (num4 > 100)
{
num4 = 100;
}
num2 = (((GameObject.Square(num4) / 60) * num) / fightingForce) / 100;
if (num2 > 0)
{
GameArea area = new GameArea();
foreach (Point point in source.GetStratagemArea(source.Position).Area)
{
if (!source.Scenario.PositionIsOnFire(point) && (source.Scenario.IsPositionEmpty(point) && source.Scenario.IsFireVaild(point, false, MilitaryType.步兵)))
{
area.Area.Add(point);
}
}
if (area.Count > 0)
{
position = source.Scenario.GetClosestPosition(area, orientations);
}
else
{
num2 = 0;
}
}
return num2;
}