public Coordinate PredictedLocation(BoogieBot.Common.Object mob) { Coordinate currentLocation = mob.GetCoordinates(); double x = currentLocation.X; double y = currentLocation.Y; double z = currentLocation.Z; double heading = mob.GetOrientation(); double dist = 4; x += Math.Cos(heading) * dist; y += Math.Sin(heading) * dist; Coordinate predictedLocation = new Coordinate((float)x, (float)y, (float)z); Coordinate closestLocatition = currentLocation; if (predictedLocation.DistanceTo(BoogieCore.world.getPlayerObject().GetCoordinates()) < closestLocatition.DistanceTo(BoogieCore.world.getPlayerObject().GetCoordinates())) closestLocatition = predictedLocation; return closestLocatition; }
public bool IsInFrontOfMe(BoogieBot.Common.Object unit) { double bearing = unit.GetOrientation(); return bearing < PI / 2.0 && bearing > -PI / 2.0; }
public bool MoveToGetThemInFront(BoogieBot.Common.Object Target, BoogieBot.Common.Object Add) { double bearing = Add.GetOrientation(); if (!IsInFrontOfMe(Add)) { BoogieCore.Log(LogType.System, "Got the add " + Add.Name + " behind me"); /* hmm, just back up? or turn a bit too? */ mover.Backwards(true); if (bearing < 0) { BoogieCore.Log(LogType.System, " back up left"); mover.RotateLeft(true); } else { BoogieCore.Log(LogType.System, " back up right"); mover.RotateRight(true); } Thread.Sleep(300); mover.RotateLeft(false); mover.RotateRight(false); Thread.Sleep(300); mover.Backwards(false); return true; } return false; }
public Coordinate InFrontOf(BoogieBot.Common.Object unit, double d) { double x = unit.GetCoordinates().X; double y = unit.GetCoordinates().Y; double z = unit.GetCoordinates().Z; double heading = unit.GetOrientation(); x += Math.Cos(heading) * d; y += Math.Sin(heading) * d; return new Coordinate((float)x, (float)y, (float)z); }