Advertisement
Guest User

Untitled

a guest
Dec 11th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.62 KB | None | 0 0
  1.  if(InDanger)
  2.             {
  3.                 for (int r = (int)crystalRadius; r < 50; 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.                         foreach (WoWGameObject obj in objList)
  14.                         {
  15.                             //float magSquared = (px - obj.Position.X) * (px - obj.Position.X) + (py - obj.Position.Y) * (py - obj.Position.Y);
  16.                             float dist = new Vector3(px, px, ObjectManager.Me.Position.Z).DistanceTo(obj.Position);
  17.  
  18.                             if (dist > crystalRadius)
  19.                             {
  20.                                 Logging.Write("Found viable position, px:" + px + " obj.positionx " + obj.Position.X + " dist:" + dist);
  21.                                 newPos = new Vector3(px, py, ObjectManager.Me.Position.Z);
  22.                                 foundSafeSpot = true;
  23.                                 break;
  24.                             }
  25.                         }
  26.                         if (foundSafeSpot)
  27.                             break;
  28.                     }
  29.                     if (foundSafeSpot)
  30.                         break;
  31.                 }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement