本文整理汇总了C#中GameObjects.LinkNode类的典型用法代码示例。如果您正苦于以下问题:C# LinkNode类的具体用法?C# LinkNode怎么用?C# LinkNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LinkNode类属于GameObjects命名空间,在下文中一共展示了LinkNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddAllAILink
private void AddAllAILink(int level, int levelMax, Architecture root, List<Architecture> path)
{
path.Add(root);
if (root != this)
{
double num = 0.0;
for (int i = 1; i < path.Count; i++)
{
num += base.Scenario.GetDistance(path[i - 1].ArchitectureArea, path[i].ArchitectureArea);
}
if (!this.AIAllLinkNodes.ContainsKey(root.ID))
{
LinkNode node = new LinkNode();
node.A = root;
node.Level = level;
foreach (Architecture architecture in path)
{
node.Path.Add(architecture);
}
node.Distance = num;
this.AIAllLinkNodes.Add(root.ID, node);
}
else if ((this.AIAllLinkNodes[root.ID].Level == level) && (this.AIAllLinkNodes[root.ID].Distance > num))
{
this.AIAllLinkNodes[root.ID].Distance = num;
this.AIAllLinkNodes[root.ID].Path.Clear();
foreach (Architecture architecture in path)
{
this.AIAllLinkNodes[root.ID].Path.Add(architecture);
}
}
else if (this.AIAllLinkNodes[root.ID].Level > level)
{
this.AIAllLinkNodes[root.ID].Level = level;
this.AIAllLinkNodes[root.ID].Path.Clear();
foreach (Architecture architecture in path)
{
this.AIAllLinkNodes[root.ID].Path.Add(architecture);
}
}
}
if (level < levelMax)
{
foreach (Architecture architecture in root.GetAILinks())
{
this.AILinkProcedureDetails.Enqueue(new AILinkProcedureDetail(level + 1, architecture, path));
}
}
}
示例2: IsSelfMoveArmyEnough
internal bool IsSelfMoveArmyEnough(LinkNode node)
{
switch (node.Kind)
{
case LinkKind.None:
return false;
case LinkKind.Land:
return (((((this.IsImportant && (this.HostileLine || this.FrontLine)) && (this.LandArmyScale > this.LargeArmyScale)) || (((this.IsImportant && !this.FrontLine) && (this.LandArmyScale > this.NormalArmyScale)) || ((!this.IsImportant && this.HostileLine) && (this.LandArmyScale > this.LargeArmyScale)))) || ((!this.IsImportant && this.FrontLine) && (this.LandArmyScale > this.NormalArmyScale))) || ((!this.IsImportant && !this.FrontLine) && (this.LandArmyScale > this.FewArmyScale)));
case LinkKind.Water:
return (((((this.IsImportant && (this.HostileLine || this.FrontLine)) && (this.WaterArmyScale > this.LargeArmyScale)) || (((this.IsImportant && !this.FrontLine) && (this.WaterArmyScale > this.NormalArmyScale)) || ((!this.IsImportant && this.HostileLine) && (this.WaterArmyScale > this.LargeArmyScale)))) || ((!this.IsImportant && this.FrontLine) && (this.WaterArmyScale > this.NormalArmyScale))) || ((!this.IsImportant && !this.FrontLine) && (this.WaterArmyScale > this.FewArmyScale)));
case LinkKind.Both:
return (((((this.IsImportant && (this.HostileLine || this.FrontLine)) && (this.ArmyScale > this.LargeArmyScale)) || (((this.IsImportant && !this.FrontLine) && (this.ArmyScale > this.NormalArmyScale)) || ((!this.IsImportant && this.HostileLine) && (this.ArmyScale > this.LargeArmyScale)))) || ((!this.IsImportant && this.FrontLine) && (this.ArmyScale > this.NormalArmyScale))) || ((!this.IsImportant && !this.FrontLine) && (this.ArmyScale > this.FewArmyScale)));
}
return false;
}
示例3: IsSelfOffensiveArmyEnough
internal bool IsSelfOffensiveArmyEnough(LinkNode node)
{
switch (node.Kind)
{
case LinkKind.None:
return false;
case LinkKind.Land:
return (((!base.Scenario.IsPlayer(node.A.BelongedFaction) && this.LandArmyScale > this.LargeArmyScale) || (node.A.IsImportant && (this.LandArmyScale > node.A.ArmyScale))) || (!node.A.IsImportant && ((this.LandArmyScale * 2) > (node.A.ArmyScale * 3))));
case LinkKind.Water:
return (((!base.Scenario.IsPlayer(node.A.BelongedFaction) && this.WaterArmyScale > this.LargeArmyScale) || (node.A.IsImportant && (this.WaterArmyScale > node.A.ArmyScale))) || (!node.A.IsImportant && ((this.WaterArmyScale * 2) > (node.A.ArmyScale * 3))));
case LinkKind.Both:
return (((!base.Scenario.IsPlayer(node.A.BelongedFaction) && this.ArmyScale > this.LargeArmyScale) || (node.A.IsImportant && (this.ArmyScale > node.A.ArmyScale))) || ((!node.A.IsImportant && (this.ArmyScale > this.NormalArmyScale)) && ((this.ArmyScale * 2) > (node.A.ArmyScale * 3))));
}
return false;
}
示例4: IsSelfFoodEnoughForOffensive
internal bool IsSelfFoodEnoughForOffensive(LinkNode node, Routeway routeway)
{
MilitaryList cropConsumptionOrderedList = Militaries;
cropConsumptionOrderedList.PropertyName = "FoodCostPerDay";
cropConsumptionOrderedList.IsNumber = true;
cropConsumptionOrderedList.ReSort();
PersonList leaderablePersonList = new PersonList();
foreach (Person p in this.Persons)
{
if (p.Command >= 40)
{
leaderablePersonList.Add(p);
}
}
switch (node.Kind)
{
case LinkKind.None:
return false;
case LinkKind.Land:
{
int crop = 0;
int troopCnt = 0;
foreach (Military m in cropConsumptionOrderedList)
{
if ((((m.Scales >= 3) && (m.Morale >= 80)) && (m.Combativity >= 80)) && (m.InjuryQuantity < m.Kind.MinScale) && m.Kind.Type != MilitaryType.水军)
{
crop += m.FoodCostPerDay;
troopCnt++;
if (troopCnt >= leaderablePersonList.Count) break;
}
}
if (routeway.LastPoint == null) return false;
return (((this.Food * (1f - routeway.LastPoint.ConsumptionRate)) * base.Scenario.Date.GetFoodRateBySeason(base.Scenario.Date.GetSeason(routeway.Length))) >= (crop * (routeway.Length + 6)));
}
case LinkKind.Water:
{
int crop = 0;
int troopCnt = 0;
foreach (Military m in cropConsumptionOrderedList)
{
if ((((m.Scales >= 3) && (m.Morale >= 80)) && (m.Combativity >= 80)) && (m.InjuryQuantity < m.Kind.MinScale) && m.Kind.Type == MilitaryType.水军)
{
crop += m.FoodCostPerDay;
troopCnt++;
if (troopCnt >= leaderablePersonList.Count) break;
}
}
if (routeway.LastPoint == null) return false;
return (((this.Food * (1f - routeway.LastPoint.ConsumptionRate)) * base.Scenario.Date.GetFoodRateBySeason(base.Scenario.Date.GetSeason(routeway.Length))) >= (crop * (routeway.Length + 6)));
}
case LinkKind.Both:
{
int crop = 0;
int troopCnt = 0;
foreach (Military m in cropConsumptionOrderedList)
{
if ((((m.Scales >= 3) && (m.Morale >= 80)) && (m.Combativity >= 80)) && (m.InjuryQuantity < m.Kind.MinScale))
{
crop += m.FoodCostPerDay;
troopCnt++;
if (troopCnt >= leaderablePersonList.Count) break;
}
}
if (routeway.LastPoint == null) return false;
return (((this.Food * (1f - routeway.LastPoint.ConsumptionRate)) * base.Scenario.Date.GetFoodRateBySeason(base.Scenario.Date.GetSeason(routeway.Length))) >= (crop * ((routeway.Length + 6) - (this.ArmyScale / 8))));
}
}
return false;
}
示例5: IsSelfHelpArmyEnough
internal bool IsSelfHelpArmyEnough(LinkNode node)
{
switch (node.Kind)
{
case LinkKind.None:
return false;
case LinkKind.Land:
return ((!this.IsImportant && (this.LandArmyScale >= this.FewArmyScale)) || (this.LandArmyScale >= this.NormalArmyScale));
case LinkKind.Water:
return ((!this.IsImportant && (this.WaterArmyScale >= this.FewArmyScale)) || (this.WaterArmyScale >= this.NormalArmyScale));
case LinkKind.Both:
return ((!this.IsImportant && (this.ArmyScale >= this.FewArmyScale)) || (this.ArmyScale >= this.NormalArmyScale));
}
return false;
}
示例6: IsNodeHelpArmyEnough
internal bool IsNodeHelpArmyEnough(LinkNode node)
{
switch (node.Kind)
{
case LinkKind.None:
return false;
case LinkKind.Land:
return ((!node.A.IsImportant && (node.A.LandArmyScale >= node.A.FewArmyScale)) || (node.A.LandArmyScale >= node.A.NormalArmyScale));
case LinkKind.Water:
return ((!node.A.IsImportant && (node.A.WaterArmyScale >= node.A.FewArmyScale)) || (node.A.WaterArmyScale >= node.A.NormalArmyScale));
case LinkKind.Both:
return ((!node.A.IsImportant && (node.A.ArmyScale >= node.A.FewArmyScale)) || (node.A.ArmyScale >= node.A.NormalArmyScale));
}
return false;
}
示例7: IsSelfFoodEnough
internal bool IsSelfFoodEnough(LinkNode node, Routeway routeway)
{
//if (routeway.LastPoint != null) //临时加上,避免跳出
{
switch (node.Kind)
{
case LinkKind.None:
return false;
case LinkKind.Land:
return (((this.Food * (1f - routeway.LastPoint.ConsumptionRate)) * base.Scenario.Date.GetFoodRateBySeason(base.Scenario.Date.GetSeason(routeway.Length))) >= (this.FoodCostPerDayOfLandMilitaries * ((routeway.Length + 6) - (this.LandArmyScale / 8))));
case LinkKind.Water:
return (((this.Food * (1f - routeway.LastPoint.ConsumptionRate)) * base.Scenario.Date.GetFoodRateBySeason(base.Scenario.Date.GetSeason(routeway.Length))) >= (this.FoodCostPerDayOfWaterMilitaries * ((routeway.Length + 6) - (this.WaterArmyScale / 8))));
case LinkKind.Both:
return (((this.Food * (1f - routeway.LastPoint.ConsumptionRate)) * base.Scenario.Date.GetFoodRateBySeason(base.Scenario.Date.GetSeason(routeway.Length))) >= (this.FoodCostPerDayOfAllMilitaries * ((routeway.Length + 6) - (this.ArmyScale / 8))));
}
}
return false;
}
示例8: GetRouteway
public Routeway GetRouteway(LinkNode node, bool hasEnd)
{
foreach (Routeway routeway in this.Routeways)
{
if ((routeway.DestinationArchitecture == node.A) && (!hasEnd || (routeway.EndArchitecture == node.A)))
{
return routeway;
}
}
return this.BuildRouteway(node, hasEnd);
}
示例9: HasRouteway
public bool HasRouteway(LinkNode node, bool hasEnd, out float rate)
{
foreach (Routeway routeway in this.Routeways)
{
if (((routeway.DestinationArchitecture == node.A) && (!hasEnd || (routeway.EndArchitecture == node.A))) && (routeway.LastPoint.ConsumptionRate <= this.BelongedFaction.RoutewayPathBuilder.ConsumptionMax))
{
rate = routeway.LastPoint.ConsumptionRate;
return true;
}
}
return this.FindRouteway(node, hasEnd, out rate);
}
示例10: CheckCampaignable
public LinkKind CheckCampaignable(LinkNode node)
{
bool flag = true;
bool flag2 = true;
for (int i = 1; i < node.Path.Count; i++)
{
flag = flag && node.Path[i - 1].IsLandLink(node.Path[i]);
flag2 = flag2 && node.Path[i - 1].IsWaterLink(node.Path[i]);
}
if (flag && flag2)
{
return LinkKind.Both;
}
if (flag)
{
return LinkKind.Land;
}
if (flag2)
{
return LinkKind.Water;
}
return LinkKind.None;
}
示例11: FindRouteway
public bool FindRouteway(LinkNode node, bool hasEnd, out float rate)
{
rate = 1f;
Point key = new Point(base.ID, node.A.ID);
if (!this.BelongedFaction.ClosedRouteways.ContainsKey(key))
{
Point? nullable;
Point? nullable2;
base.Scenario.GetClosestPointsBetweenTwoAreas(this.GetRoutewayStartPoints(), node.A.GetAIRoutewayEndPoints(this, true), out nullable, out nullable2);
if (nullable.HasValue && nullable2.HasValue)
{
this.BelongedFaction.RoutewayPathBuilder.MultipleWaterCost = node.Kind == LinkKind.Land;
if (this.BelongedFaction.RoutewayPathAvail(nullable.Value, nullable2.Value, hasEnd))
{
rate = this.BelongedFaction.RoutewayPathBuilder.PathConsumptionRate;
return true;
}
}
}
return false;
}
示例12: BuildRouteway
public Routeway BuildRouteway(LinkNode node, bool hasEnd)
{
Point key = new Point(base.ID, node.A.ID);
if (!this.BelongedFaction.ClosedRouteways.ContainsKey(key))
{
Point? nullable;
Point? nullable2;
base.Scenario.GetClosestPointsBetweenTwoAreas(this.GetRoutewayStartPoints(), node.A.GetAIRoutewayEndPoints(this, true), out nullable, out nullable2);
if (nullable.HasValue && nullable2.HasValue)
{
this.BelongedFaction.RoutewayPathBuilder.MultipleWaterCost = false;
this.BelongedFaction.RoutewayPathBuilder.MustUseWater = node.Kind == LinkKind.Water;
if (this.BelongedFaction.RoutewayPathAvail(nullable.Value, nullable2.Value, hasEnd))
{
Routeway routeway = this.CreateRouteway(this.BelongedFaction.GetCurrentRoutewayPath());
routeway.DestinationArchitecture = node.A;
if (hasEnd)
{
routeway.EndArchitecture = node.A;
}
return routeway;
}
this.BelongedFaction.ClosedRouteways.Add(new Point(base.ID, node.A.ID), null);
}
}
return null;
}
示例13: isArmyNavigableTo
private bool isArmyNavigableTo(LinkNode targetNode, Military military)
{
return GlobalVariables.LandArmyCanGoDownWater ||
((targetNode.Kind == LinkKind.Land && military.Kind.Type != MilitaryType.水军) || (targetNode.Kind == LinkKind.Water && military.Kind.Type == MilitaryType.水军) || targetNode.Kind == LinkKind.Both);
}
示例14: HasHostileArchitectureOnPath
private bool HasHostileArchitectureOnPath(LinkNode node)
{
foreach (Architecture architecture in node.Path)
{
if (((architecture != this) && (architecture != node.A)) && !((architecture.BelongedFaction == null) || this.IsFriendly(architecture.BelongedFaction)))
{
return true;
}
}
return false;
}
示例15: HasCloserOffensiveArchitecture
private bool HasCloserOffensiveArchitecture(LinkNode node, out Architecture closer)
{
closer = null;
foreach (Architecture architecture in this.BelongedFaction.Architectures)
{
if (architecture != this)
{
LinkNode node2 = null;
architecture.AIAllLinkNodes.TryGetValue(node.A.ID, out node2);
if (((node2 != null) && (node2.Level < node.Level)) && (node2.Kind != LinkKind.None))
{
closer = architecture;
return true;
}
}
}
return false;
}