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


C# Troop.IsMovableOnPosition方法代码示例

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


在下文中一共展示了Troop.IsMovableOnPosition方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetCampaignPosition

 public Point? GetCampaignPosition(Troop troop, List<Point> orientations, bool close)
 {
     GameArea allAvailableArea = this.GetAllAvailableArea(false);
     GameArea sourceArea = new GameArea();
     foreach (Point point in allAvailableArea.Area)
     {
         if ((base.Scenario.GetArchitectureByPosition(point) == this || troop.IsMovableOnPosition(point)) && base.Scenario.GetTroopByPosition(point) == null)
         {
             sourceArea.Area.Add(point);
         }
     }
     GameArea highestFightingForceArea = troop.GetHighestFightingForceArea(sourceArea);
     if (highestFightingForceArea != null)
     {
         if (close)
         {
             return base.Scenario.GetClosestPosition(highestFightingForceArea, orientations);
         }
         return base.Scenario.GetFarthestPosition(highestFightingForceArea, orientations);
     }
     return null;
 }
开发者ID:ptmaster,项目名称:ZhongHuaSanGuoZhi,代码行数:22,代码来源:Architecture.cs

示例2: GetTroopEnterableArea

 public GameArea GetTroopEnterableArea(Troop troop)
 {
     GameArea area = new GameArea();
     foreach (Point point in this.ArchitectureArea.Area)
     {
         if (base.Scenario.GetWaterPositionMapCost(troop.Army.Kind.Type, point) < 3500)
         {
             area.AddPoint(point);
         }
     }
     foreach (Point point in this.ContactArea.Area)
     {
         if (troop.IsMovableOnPosition(point) && (base.Scenario.GetWaterPositionMapCost(troop.Army.Kind.Type, point) < 3500))
         {
             area.AddPoint(point);
         }
     }
     return area;
 }
开发者ID:ptmaster,项目名称:ZhongHuaSanGuoZhi,代码行数:19,代码来源:Architecture.cs

示例3: AIFacility


//.........这里部分代码省略.........
                    if (architecture.BelongedSection == this.BelongedSection)
                    {
                        list.Add(architecture);
                    }
                    else if (architecture.BelongedSection.AIDetail.AllowFundTransfer && ((architecture.BelongedSection.OrientationSection == this.BelongedSection) || (architecture.BelongedSection.OrientationSection == null)))
                    {
                        list.Add(architecture);
                    }
                }
                foreach (Architecture architecture in list)
                {
                    fund = 0;
                    if (architecture.Fund > architecture.AbundantFund)
                    {
                        fund = 0x3e8;
                        if (architecture.BelongedSection.OrientationSection == this.BelongedSection)
                        {
                            fund *= 2;
                            if (fund > architecture.Fund)
                            {
                                fund = architecture.Fund;
                            }
                        }
                    }
                    else if (architecture.Fund > architecture.EnoughFund)
                    {
                        fund = 500;
                        if (architecture.BelongedSection.OrientationSection == this.BelongedSection)
                        {
                            fund *= 2;
                            if (fund > architecture.Fund)
                            {
                                fund = architecture.Fund;
                            }
                        }
                    }
                    if (fund > 0)
                    {
                        architecture.DecreaseFund(fund);
                        this.AddFundPack(fund, base.Scenario.GetTranferFundDays(architecture, this));
                        num2 += fund;
                    }
                    if (num2 > num)
                    {
                        break;
                    }
                }
            }
            else if (((this.TransferFundArchitecture != null) && (this.TransferFundArchitecture.BelongedFaction == this.BelongedFaction)) && (this.TransferFundArchitecture.Fund < this.TransferFundArchitecture.FundCeiling))
            {
                fund = this.Fund - this.EnoughFund;
                if (fund > 500)
                {
                    this.DecreaseFund(fund);
                    this.TransferFundArchitecture.AddFundPack(fund, base.Scenario.GetTranferFundDays(this, this.TransferFundArchitecture));
                }
            }
            else if (this.BelongedSection != null && this.BelongedSection.AIDetail.AllowFundTransfer && this.IsFundAbundant)
            {
                foreach (Architecture architecture in this.GetOtherArchitectureList())
                {
                    if (!architecture.IsFundEnough)
                    {
                        fund = 0x3e8;
                        if (fund > this.Fund)
                        {
                            fund = this.Fund;
                        }
                        if (fund > 0)
                        {
                            this.DecreaseFund(fund);
                            architecture.AddFundPack(fund, base.Scenario.GetTranferFundDays(this, architecture));
                        }
                    }
                    if (!this.IsFundAbundant)
                    {
                        break;
                    }
                }
            }
        }

        */
        private Point? GetRandomStartingPosition(Troop troop)
        {
            GameArea allAvailableArea = this.GetAllAvailableArea(false);
            GameArea sourceArea = new GameArea();
            foreach (Point point in allAvailableArea.Area)
            {
                if (((base.Scenario.GetArchitectureByPosition(point) == this) && (base.Scenario.GetTroopByPosition(point) == null)) || troop.IsMovableOnPosition(point))
                {
                    sourceArea.Area.Add(point);
                }
            }
            if (sourceArea.Count == 0)
            {
                return null;
            }
            return sourceArea[GameObject.Random(sourceArea.Count)];
        }
开发者ID:ptmaster,项目名称:ZhongHuaSanGuoZhi,代码行数:101,代码来源:Architecture.cs


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