// Use the base constructor public KebabBot(string botName, int botTeam, int botIndex) : base(botName, botTeam, botIndex) { controller = new Controller(); map = new Map(); allyTeam = (Goal.TEAM)botTeam; enemyTeam = allyTeam == Goal.TEAM.BLUE ? Goal.TEAM.ORANGE : Goal.TEAM.BLUE; car = new Octane(); }
public Vector3 GetRightFacingEnemyGoal(Goal.TEAM ourTeam, Goal goal) { Vector3 right = new Vector3() { X = goal.RightPost.X, Y = goal.RightPost.Y }; Vector3 pR = (right - Location) * -1; pR = Vector3.Normalize(pR); pR *= Ball.Radius; return(pR + Location); }
public Vector3 GetLeftFacingEnemyGoal(Goal.TEAM ourTeam, Goal goal) { Vector3 left = new Vector3() { X = goal.LeftPost.X, Y = goal.LeftPost.Y }; Vector3 pL = (left - Location) * -1; pL = Vector3.Normalize(pL); pL *= Ball.Radius; return(pL + Location); }
public static Destination Shoot(Goal allyGoal, Goal enemyGoal, GameState gameState, BotState botState, Goal.TEAM enemyTeam) { //Get the location to hit on the ball Ball ball = gameState.Ball; Vector3 left = ball.GetRightFacingEnemyGoal(enemyTeam, allyGoal); Vector3 right = ball.GetLeftFacingEnemyGoal(enemyTeam, allyGoal); Vector3 location = (left + right) / 2f; //Get the angular velocity to hit the ball with Vector3 goalCenter = enemyGoal.GetCenter2D(); Vector3 velocity = goalCenter - location; return(new Destination() { Location = location, Velocity = velocity }); }
public static Destination DecideDestination(Map map, GameState gameState, BotState botState, Goal.TEAM allyTeam, Goal.TEAM enemyTeam) { Destination destination = new Destination(); destination = Shoot(map.GetGoal(allyTeam), map.GetGoal(enemyTeam), gameState, botState, enemyTeam); return(destination); }
public static void DrawBallFrontFacingOurGoal(Renderer renderer, Ball ball, Goal.TEAM enemyTeam, Goal goal, Vector3 location) { Vector3 frontLeft = ball.GetLeftFacingAllyGoal(enemyTeam, goal, location); Vector3 frontRight = ball.GetRightFacingAllyGoal(enemyTeam, goal, location); //renderer.DrawLine3D(Color.FromRgb(0, 0, 255), frontLeft, frontRight); }
public static void DrawBallFrontFacingEnemyGoal(Renderer renderer, Ball ball, Goal.TEAM ourTeam, Goal goal, Vector3 location) { Vector3 frontLeft = ball.GetLeftFacingEnemyGoal(ourTeam, goal); Vector3 frontRight = ball.GetRightFacingEnemyGoal(ourTeam, goal); renderer.DrawLine3D(Color.FromRgb(255, 0, 0), frontLeft, frontRight); }
public static void DrawAll(Renderer renderer, BotState botState, Car car, Ball ball, Map map, Goal.TEAM allyTeam, Goal.TEAM enemyTeam) { Debug.DrawCarCenter(renderer, botState.Location); Debug.DrawCarOutline(renderer, car, botState); Debug.DrawBallFrontFacingEnemyGoal(renderer, ball, allyTeam, map.GetGoal(enemyTeam), botState.Location); Debug.DrawBallFrontFacingOurGoal(renderer, ball, enemyTeam, map.GetGoal(allyTeam), botState.Location); }
/// <summary> /// Returns the Goal object associated with the given team /// </summary> /// <param name="team">The Team of which we want to get the goal</param> /// <returns>The requested Goal object</returns> public Goal GetGoal(Goal.TEAM team) { return(Goals.Where(el => el.Team == team).FirstOrDefault()); }
public Vector3 GetRightFacingAllyGoal(Goal.TEAM enemyTeam, Goal goal, Vector3 Location) { Vector3 frontLeft = new Vector3(Radius, 0, 0); return(Rotation.Rotate2D((float)(3 * Math.PI / 4 + Math.PI * (int)enemyTeam + GetGoalAngle(goal)), frontLeft) + Location); }