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


C# Walker.ExecuteWaypoint方法代码示例

本文整理汇总了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;
        }
开发者ID:KyLuaa,项目名称:bot,代码行数:101,代码来源:Cavebot.cs


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