本文整理汇总了C#中GameObjects.GameArea.HasPoint方法的典型用法代码示例。如果您正苦于以下问题:C# GameArea.HasPoint方法的具体用法?C# GameArea.HasPoint怎么用?C# GameArea.HasPoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GameObjects.GameArea
的用法示例。
在下文中一共展示了GameArea.HasPoint方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BuildThreeTierPath
private bool BuildThreeTierPath(MilitaryKind kind)
{
bool path = false;
if (!this.HasPath)
{
if (this.BelongedFaction != null && !base.Scenario.IsPlayer(this.BelongedFaction) && this.TargetArchitecture == null && !this.IsViewingWillArchitecture() &&
this.TargetTroop == null && this.BelongedLegion != null && this.BelongedLegion.Kind == LegionKind.Offensive)
{
MilitaryKind trueKind = this.Army.KindID == 28 ? this.Army.RealMilitaryKind : this.Army.Kind;
List<Point> refPath = null;
bool aapUsable = this.StartingArchitecture.GetAllContactArea().Area.Contains(this.Position);
if (aapUsable && base.Scenario.pathCache.ContainsKey(new PathCacheKey(this.StartingArchitecture, this.WillArchitecture, trueKind)))
{
refPath = base.Scenario.pathCache[new PathCacheKey(this.StartingArchitecture, this.WillArchitecture, trueKind)];
}
if (refPath != null && refPath.Count > 0 && aapUsable)
{
path = ConstructTruePath(refPath, kind);
}
else if (refPath == null && (this.StartingArchitecture != this.WillArchitecture || !aapUsable))
{
Point? p1;
Point? p2;
// 出发建筑的点应该包括建筑邻近的点
GameArea startingArea = new GameArea();
foreach (Point p in this.StartingArchitecture.ContactArea.Area)
startingArea.AddPoint(p);
foreach (Point p in this.StartingArchitecture.ArchitectureArea.Area)
startingArea.AddPoint(p);
startingArea.Centre = this.StartingArchitecture.ArchitectureArea.Centre;
GameArea willArea = new GameArea();
foreach (Point p in this.WillArchitecture.ArchitectureArea.Area)
willArea.AddPoint(p);
willArea.Centre = this.WillArchitecture.ArchitectureArea.Centre;
base.Scenario.GetClosestPointsBetweenTwoAreas(startingArea, willArea, out p1, out p2);
if (p1.HasValue && p2.HasValue)
{
bool ftPath = this.pathFinder.GetFirstTierPath(p1.Value, p2.Value, kind);
if (ftPath)
{
if (this.FirstTierPath != null && this.FirstTierPath.Count > 0)
{
// 去除多余的点
int i = 0;
while (startingArea.HasPoint(this.FirstTierPath[i]))
{
i++;
if (i >= this.FirstTierPath.Count)
{
i = this.FirstTierPath.Count - 1;
break;
}
}
this.FirstTierPath.RemoveRange(0, i);
i = this.FirstTierPath.Count - 1;
while (willArea.HasPoint(this.FirstTierPath[i]))
{
i--;
if (i < 0)
{
i = 0;
break;
}
}
this.FirstTierPath.RemoveRange(i + 1, this.FirstTierPath.Count - i - 1);
if (aapUsable)
{
base.Scenario.pathCache[new PathCacheKey(this.StartingArchitecture, this.WillArchitecture, this.Army.Kind)] = this.FirstTierPath;
}
path = ConstructTruePath(this.FirstTierPath, kind);
}
else
{
if (aapUsable)
{
base.Scenario.pathCache[new PathCacheKey(this.StartingArchitecture, this.WillArchitecture, this.Army.Kind)] = new List<Point>();
}
}
}
}
}
else if (refPath == null || (refPath.Count == 0 && this.Army.Kind.Type != MilitaryType.水军))
{
this.StartingArchitecture.actuallyUnreachableArch.Add(this.WillArchitecture);
this.GoBack();
return false;
}
}
if (!path)
{
this.EnableOneAdaptablility = true;
bool flag2 = false;
if ((this.BelongedFaction != null) && !GameObject.Chance(0x21))
{
flag2 = true;
foreach (Troop troop in this.BelongedFaction.Troops)
//.........这里部分代码省略.........