/// <summary> /// doesn't work sometimes /// </summary> /// <param name="co"></param> /// <returns></returns> private double GetMyDistanceTo(CoordsObject co) { try { WorldObjectCollection woc = Core.WorldFilter.GetByObjectClass(ObjectClass.Player); CoordsObject myCoords = woc.Current.Coordinates(); return(myCoords.DistanceToCoords(co)); } catch (Exception ex) { errorLogging.LogError(ErrorLogFile, ex); } return(-1); }
public void LineThemUp(double MyDestNS, double MyDestEW) { MyDistanceTo = 1.0; MyDestination = new CoordsObject(MyDestNS, MyDestEW); PlayerCoords = new Coordinates(Host.Actions.Landcell, Host.Actions.LocationY, Host.Actions.LocationX); MyLocation = new CoordsObject(PlayerCoords.NS, PlayerCoords.EW); MyAngleTo = MyLocation.AngleToCoords(MyDestination); if (MyAngleTo < 90) { MyAngleTo = MyAngleTo - 90 + 360; } else { MyAngleTo = MyAngleTo - 90; } MyDistanceTo = MyLocation.DistanceToCoords(MyDestination); Host.Actions.FaceHeading(MyAngleTo, true); startTurningTimer(1000); }
public static double GetDistance(CoordsObject coords1, CoordsObject coords2) { return coords1.DistanceToCoords(coords2) * 240; }