private Vector3 GetBlockDefensivePosition(Vector3 ballPosition) { if (_matchStatus?.IsServe ?? false) { return(Position); } var fowardDirection = TeamFoward.z; var netDistance = 0.1f * fowardDirection; if (!Opponents.Any()) { return(Position); } var horizontalPosition = Opponents.OrderBy(x => Position.Distance(x.Position)).First().Position.x; return(new Vector3(horizontalPosition, 0, netDistance)); }
public Snaffle AccioOn(Wizard w) { Point w2 = new Point() { X = w.X + w.VX, Y = w.Y + w.VY }; bool op = Opponents.Any(x => Between(x.X + x.VX, w2.X, MyGoal.X)); List <Snaffle> snf = Snaffles.Where(x => Between(x.X, w2.X, MyGoal.X)).ToList(); if (snf.Count > 0 && op) { Snaffle s = GetNearSnuffle(w2, snf); if (w2.PrecisionLength(s) < 2000) { return(s); } } return(null); }