当前位置: 首页>>代码示例>>C#>>正文


C# Troop.GetStratagemArea方法代码示例

本文整理汇总了C#中GameObjects.Troop.GetStratagemArea方法的典型用法代码示例。如果您正苦于以下问题:C# Troop.GetStratagemArea方法的具体用法?C# Troop.GetStratagemArea怎么用?C# Troop.GetStratagemArea使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GameObjects.Troop的用法示例。


在下文中一共展示了Troop.GetStratagemArea方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
 }
开发者ID:skicean,项目名称:ZhongHuaSanGuoZhi,代码行数:57,代码来源:InfluenceKind398.cs

示例2: GetCreditWithPosition

 public override int GetCreditWithPosition(Troop source, out Point? position)
 {
     //position = 0;
     position = new Point(0, 0);
     int num = 0;
     if (((source.BelongedLegion == null) || source.Scenario.PositionIsOnFireNoCheck(source.Position)) || (GameObject.Random(source.BelongedLegion.Troops.Count) <= 0))
     {
         int pureFightingForce = source.PureFightingForce;
         int num3 = source.TroopIntelligence + source.ChanceIncrementOfStratagem;
         if (num3 > 100)
         {
             num3 = 100;
         }
         num3 = GameObject.Square(num3) / 60;
         if (num3 > 0)
         {
             List<Point> list = new List<Point>();
             foreach (Point point in source.GetStratagemArea(source.Position).Area)
             {
                 if (source.Scenario.PositionIsOnFire(point))
                 {
                     num += num3 / 40;
                     list.Add(point);
                     Troop troopByPosition = source.Scenario.GetTroopByPosition(point);
                     if (troopByPosition == source)
                     {
                         num += num3 * 3;
                     }
                     else if (troopByPosition != null)
                     {
                         if (source.IsFriendly(troopByPosition.BelongedFaction))
                         {
                             num += (num3 * troopByPosition.FightingForce) / pureFightingForce;
                         }
                         else
                         {
                             num -= (num3 * troopByPosition.FightingForce) / pureFightingForce;
                         }
                     }
                 }
             }
             if (num > 0)
             {
                 position = new Point?(source.Position);
             }
         }
     }
     return num;
 }
开发者ID:skicean,项目名称:ZhongHuaSanGuoZhi,代码行数:49,代码来源:InfluenceKind396.cs


注:本文中的GameObjects.Troop.GetStratagemArea方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。