Exemple #1
0
        protected double TryPath(Vector3 start, Vector3 end, out System.Collections.Generic.List <Hop> hops, bool acceptIncomplete)
        {
            var result = Pather.FindPath(start, end);

            Assert.IsNotNull(result);
            Assert.Greater(result.Count, 0);

            // make sure we didn't get an incomplete path
            if (!acceptIncomplete)
            {
                Assert.Less((end - result[result.Count - 1].Location).Length(), 5f);
            }

            foreach (var hop in result)
            {
                float tx, ty;
                Pather.GetTileByLocation(hop.Location.ToRecast().ToFloatArray(), out tx, out ty);
                Console.WriteLine("TX: " + tx + " TY: " + ty + " X: " + hop.Location.X + " Y: " + hop.Location.Y + " Z: " + hop.Location.Z);
            }
            Console.WriteLine("Memory: " + (Pather.MemoryPressure / 1024 / 1024) + "MB");

            double length = 0;

            for (int i = 0; i < result.Count - 1; i++)
            {
                length += (result[i].Location - result[i + 1].Location).Length();
            }
            hops = result;
            return(length);
        }
Exemple #2
0
        public void TestMinimapImage()
        {
            float x, y;

            Pather.GetTileByLocation(new[] { -8020, 1515, -1.5f }.ToRecast(), out x, out y);

            var image = new MinimapImage("Azeroth", 256, 256, (int)x, (int)x, (int)y, (int)y);

            image.Generate();
            image.Result.Save("S:\\meshReader\\MinimapImageTest.png", ImageFormat.Png);
        }
Exemple #3
0
 public static void GetTileByPosition(Point position, out float x, out float y, string continentId = "")
 {
     if (string.IsNullOrEmpty(continentId))
     {
         continentId = Usefuls.ContinentNameMpq;
     }
     if (_pather == null)
     {
         _pather = new Pather(continentId);
     }
     if (_pather.Continent != continentId)
     {
         _pather.Dispose();
         _pather = new Pather(continentId);
     }
     _pather.GetTileByLocation(position, out x, out y);
 }