private Vector3?getClosestBoost(rlbot.flat.GameTickPacket gameTickPacket, Vector3 carLocation) { Vector3?closest = null; double closestDistance = 0; for (int i = 0; i < gameTickPacket.BoostPadStatesLength; i++) { rlbot.flat.BoostPadState boostPadState = (rlbot.flat.BoostPadState)gameTickPacket.BoostPadStates(i); rlbot.flat.BoostPad boostPosition = (rlbot.flat.BoostPad)GetFieldInfo().BoostPads(i); double boostDistance = getDistance2D(carLocation.X, boostPosition.Location.Value.X, carLocation.Y, boostPosition.Location.Value.Y); if (boostPadState.IsActive && boostPosition.IsFullBoost && (closest == null || closestDistance > boostDistance)) { closestDistance = boostDistance; closest = fromFramework((rlbot.flat.Vector3)boostPosition.Location); } } return(closest); }
public BoostPad(rlbot.flat.BoostPad boostPad) { Location = boostPad.Location.Value.ToVector3(); IsFullBoost = boostPad.IsFullBoost; }