Advertisement
Guest User

Untitled

a guest
Dec 11th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.05 KB | None | 0 0
  1.  Vector3 newPos = ObjectManager.Me.Position;
  2.  
  3.             for (int r = 5; r < 10; r++)
  4.             {
  5.                 float sampleAngle = 15;
  6.                 for(int i = 0; i < sampleAngle; i++)
  7.                 {
  8.                     float angle = i / sampleAngle * 2.0f * 2 * (float)System.Math.PI;
  9.                     angle = angle + ((2 * (float)System.Math.PI) / sampleAngle) * (float)rand.NextDouble();
  10.                     float px = ObjectManager.Me.Position.X+ r * (float)System.Math.Cos(angle);
  11.                     float py = ObjectManager.Me.Position.Y + r * (float)System.Math.Cos(angle);
  12.  
  13.                     float closestPoint = float.MaxValue;
  14.                     /*foreach (WoWGameObject obj in objList)
  15.                     {
  16.                         float magSquared = (px - obj.Position.X) * (px - obj.Position.X) + (py - obj.Position.Y) * (py - obj.Position.Y);
  17.  
  18.                         if (magSquared <= crystalRadius * crystalRadius)
  19.                         {
  20.                             Logging.Write("px:" + px + " obj.positionx " + obj.Position.X + " dist:" + magSquared);
  21.                             newPos = new Vector3(px, py, ObjectManager.Me.Position.Z);
  22.                             return;
  23.                         }
  24.  
  25.                     }*/
  26.                     newPos = new Vector3(px, py, ObjectManager.Me.Position.Z);
  27.                     Logging.Write("x:" + ObjectManager.Me.Position.X + " y: " + ObjectManager.Me.Position.Y + " z: " + ObjectManager.Me.Position.Z + " px:" + px + " py: " + py);
  28.                     while (ObjectManager.Me.Position.DistanceTo(newPos) > 5 || ObjectManager.GetWoWGameObjectByName("Crystal Spike").Count != 0)
  29.                     {
  30.                         MovementManager.Go(PathFinder.FindPath(newPos), false);
  31.                         Logging.Write("Moving! Dist:" + ObjectManager.Me.Position.DistanceTo(newPos) +  " crystal spikes" + ObjectManager.GetWoWGameObjectByName("Crystal Spike").Count);
  32.                         Thread.Sleep(1000);
  33.                     }
  34.                     return;
  35.                 }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement