Пример #1
0
        private void btnGenPath_Click(object sender, EventArgs e)
        {
            if (!Manager.ObjectManager.IsInGame)
            {
                return;
            }

            if (_pos1 == default(Location) || _pos2 == default(Location))
            {
                return;
            }

            try
            {
                string map = WoWWorld.CurrentMap;
                Log.WriteLine("Generate path from {0} to {1} in {2}", _pos1, _pos2, map);
                var mesh = new Pather("Kalimdor");
                mesh.LoadAppropriateTiles(_pos1.ToVector3(), _pos2.ToVector3());
                List <Vector3> path = mesh.DetourMesh.FindPath(_pos1.ToFloatArray(), _pos2.ToFloatArray(), false);
                foreach (Vector3 point in path)
                {
                    Log.WriteLine("[{0}]", point.ToString());
                }
            }
            catch (Exception ex)
            {
                Log.WriteLine("NavMesh: {0}", ex.Message);
            }
        }