本文整理汇总了C#中Walker.ExecuteWaypoint方法的典型用法代码示例。如果您正苦于以下问题:C# Walker.ExecuteWaypoint方法的具体用法?C# Walker.ExecuteWaypoint怎么用?C# Walker.ExecuteWaypoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Walker
的用法示例。
在下文中一共展示了Walker.ExecuteWaypoint方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Run
//.........这里部分代码省略.........
currentCorpseLocation = Objects.Location.Invalid;
continue;
}
Map.TileObject topItem = tile.GetTopUseItem(false);
if (!topItem.HasFlag(Enums.ObjectPropertiesFlags.IsContainer))
{
corpseLocations.Remove(currentCorpseLocation);
currentCorpseLocation = Objects.Location.Invalid;
continue;
}
if (playerLoc.DistanceTo(currentCorpseLocation) >= 2)
{
Map.TileCollection adjTiles = tileCollection.GetAdjacentTileCollection(tile);
int adjDistance = playerLoc.GetTilesToLocation(this.Client,
tile.WorldLocation, tileCollection, this.PathFinder, true).ToArray().Length;
Objects.Location adjLoc = Objects.Location.Invalid;
foreach (Map.Tile adjTile in adjTiles.GetTiles())
{
if (!adjTile.IsWalkable()) continue;
var tilesToCorpse = playerLoc.GetTilesToLocation(this.Client,
adjTile.WorldLocation, tileCollection, this.PathFinder, true).ToArray();
if (tilesToCorpse.Length == 0) continue;
int dist = tilesToCorpse.Length - 1;
if (dist < adjDistance)
{
adjDistance = dist;
adjLoc = adjTile.WorldLocation;
}
}
if (adjLoc.IsValid())
{
this.Client.Player.GoTo = adjLoc;
continue;
}
corpseLocations.Remove(currentCorpseLocation);
currentCorpseLocation = Objects.Location.Invalid;
continue;
}
// we're in range to open the corpse, so let's open it
looter.OpenCorpse(tileCollection, tile);
continue;
}
else
{
this.Client.Player.GoTo = currentCorpseLocation;
continue;
}
}
else currentCorpseLocation = Objects.Location.Invalid;
}
#endregion
#region waypoints
if (walker.IsRunning)
{
walker.UpdateCache(tileCollection);
continue;
}
else if (this.Waypoints.Count > 0)
{
// check if this is the first time we're running the walker
// and if waypoint index wasn't set by user
// if so, find the closest waypoint
if (currentWaypoint == null && this.CurrentWaypointIndex == 0)
{
int distance = 200;
Waypoint closestWaypoint = null;
foreach (Waypoint wp in this.GetWaypoints())
{
if (!playerLoc.IsInRange(wp.Location)) continue;
int wpDist = (int)playerLoc.DistanceTo(wp.Location);
if (distance > wpDist)
{
distance = wpDist;
closestWaypoint = wp;
}
}
if (closestWaypoint == null) continue;
currentWaypoint = closestWaypoint;
}
else currentWaypoint = this.Waypoints[this.CurrentWaypointIndex];
walker.ExecuteWaypoint(currentWaypoint, tileCollection);
}
#endregion
}
catch (Exception ex)
{
}
}
this.CleanupCalled -= anonCleanup;
}